Saturday, July 5, 2008

My simplest log4j.properties

I don't mind log4j, but I don't like configuring it. Why doesn't it just log everything on info by default? Instead, you HAVE to configure it. And because I've always wanted it to just work, I've never bothered to learn its intricacies (of which there are many). So, here is my super simple log4j.properties, for others that just want it to log stuff:

log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
log4j.appender.STDOUT.layout.ConversionPattern=%d %p [%t] %C{1} - %m\n

log4j.category.com.myapp=INFO, STDOUT
log4j.category.org.hibernate=ERROR, STDOUT
log4j.category.org=INFO, STDOUT
log4j.category.com=INFO, STDOUT