... until the collector arrives ...

This "blog" is really just a scratchpad of mine. There is not much of general interest here. Most of the content is scribbled down "live" as I discover things I want to remember. I rarely go back to correct mistakes in older entries. You have been warned :)

2007-01-16

log4j Logging

I'd like more dollars for looking up this as well...

To configure log4j logging, the file log4j.properties must be present on the classpath.  It looks like this:

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=hibernate.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

log4j.rootLogger=debug, stdout, file

log4j.logger.org.hibernate.SQL=debug
log4j.logger.org.hibernate.type=info

Again, the level in bold limits what is written to the appenders.  The levels are TRACE, DEBUG, INFO, WARN, ERROR, and FATAL.  More information can be found in the log4j javadocs.

Blog Archive