views:

316

answers:

1

I have inherited some Java code that does some testing of our XMLRPC server. So far so good. Part of that code deals with stopping the server (a few repetitions of "check if server still there and if so send it command to shut down").

As the server is shutting down, some of these "is the server still there?" and/or "tell it to shut down" requests may fail in mid-operation causing the apache XMLRPC lib to write out some warning to stderr (e.g. "INFO: I/O exception (org.apache.commons.httpclient.NoHttpResponseException) caught when processing request: The server 127.0.0.1 failed to respond"). These messages are completely irrelevant to us but cause our CI system to worry.

Is there a way to suppress such info messages (preferably programmatically so that we only suppress them when shutting down) in this Apache module?

The application includes commons-logging-1.1.jar in its classpath, so that might be what is used. But that still doesn't tell me how to do it programmatically.

A: 

I agree with skaffman's comment, but you shouldn't need to do it programmatically - just by changing the server configuration. (Exactly how depends on your server.)

If you do have to do it programmatically, the exact code will depend on the underlying logging implementation (say, log4j or java.util.logging, but it will be something like

//The logger name is usually the fully-qualified class name
Logger logger = Logger.getLogger("logger-name-which-you-want-to-keep-quiet");
logger.setLevel(Level.ERROR); // or whatever - this will suppress lower levels
Vinay Sajip
My problem is that I don't know hat the underlying logging implementation is -- how do I find that out? And what is the name of the logger I want to keep quiet? I have no clue about these megabytes of Java code to do some trivial HTTP REST calls and my Google foo is too bad to find anything sensible.
HD
To find which logging implementation, look at the jars used by your appserver and webapp. To find the logger name, if it's not `org.apache.commons.httpclient`, then check your logs to see if the name is printed out there.
Vinay Sajip