I would like to use a properties file to configure log4j. I am wondering how I need to edit the log4j.properties file to accomplish these goals below:
1. Root logger is set to WARN logging level. So the default logging for any class will always be WARN.
2. Any logging for classes in the hierarchy "com.mycompany.myproject" will have DEBUG logging level. I don't want to specify every class explicitly in the properties file.
3. Both 1 and 2 are logging to the same appender.
Here is an example properties file that accomplishes #1 above, but not #2. No logging output for #2 is captured other than WARN level and higher.
log4j.rootLogger=WARN,thea
ppender
log4j.logger.com.thecompan
y.theproje
ct=DEBUG,t
heappender
log4j.appender.theappender
.layout=or
g.apache.l
og4j.Patte
rnLayout
log4j.appender.theappender
.layout.Co
nversionPa
ttern=%d{I
SO8601} %-5p - %m%n
log4j.appender.theappender
=org.apach
e.log4j.Ro
llingFileA
ppender
log4j.appender.theappender
.File=/tmp
/theappend
er.log
log4j.appender.theappender
.MaxFileSi
ze=500KB
log4j.appender.theappender
.MaxBackup
Index=50
Start Free Trial