Hi, Avi. I've been working in Java since 1.0, and there's always more to learn.
A couple of my useful logging results:
To get rid of the two-line log message format from Java's SimpleFormatter,
create a class like this:
public class ReallySimpleFormatter extends java.util.logging.Formatter {
@Override public String format(java.util.logging.LogRecord record) {
return record.getMessage() + "\n";
}
}
And attach it to the default handlers like this:
Handler[] handlers = Logger.getLogger("").getHandlers();
for (int h=0; h<handlers.length; h++)
handlers[h].setFormatter(new ReallySimpleFormatter());
To get rid of the startup Info messages from Jetty (if you're using the HTTP or
AJP protocols on Component):
1. Make sure org.slf4j.jar is in your classpath, so Jetty uses the system
loggers rather than its own StdErr logger.
2. Add this setting:
Logger.getLogger("org.mortbay.log").setLevel(Level.WARNING);
(It would probably be cleaner to configure both of these using the logging
config file, but since I've gotten it working, I'm not inclined to mess with
it.)
-- Jim