Here\'s what I\'m trying to do: I want 2 log files: The first logs INFO level and up for all parts of the applications but also logs DEBUG and up for some packages. The seco
Here is what I eventually came up with that did the trick:
log4j.rootLogger=INFO,console,stdLog,errorLog
#console appender
log4j.appender.console = org.apache.log4j.ConsoleAppender
log4j.appender.console.layout = org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern = %t %-5p %c{2} - %m%n
#file appender
log4j.appender.stdLog=org.apache.log4j.DailyRollingFileAppender
log4j.appender.stdLog.DatePattern = '.'yyyy-MM-dd
log4j.appender.stdLog.File = log/log.txt
log4j.appender.stdLog.layout = org.apache.log4j.PatternLayout
log4j.appender.stdLog.layout.ConversionPattern = [%d{ISO8601}]%5p%6.6r[%t]%x(%F:%L) - %m%n
#file appender
log4j.appender.errorLog = org.apache.log4j.DailyRollingFileAppender
log4j.appender.errorLog.DatePattern = '.'yyyy-MM-dd
log4j.appender.errorLog.File = log/errorlog.txt
log4j.appender.errorLog.layout = org.apache.log4j.PatternLayout
log4j.appender.errorLog.layout.ConversionPattern = [%d{ISO8601}]%5p%6.6r[%t]%x(%F:%L) - %m%n
log4j.appender.errorLog.Threshold=ERROR
#Specific log levels
log4j.category.com.mypackage1=DEBUG
log4j.category.com.mypackage2=DEBUG
This makes 2 logs, one which logs everything at Warn or above plus at DEBUG or above on the specified packages for the standard log and at ERROR and above only across all packages to the error log.