I have two java app working together.
I'm trying to configure my log4j.properties file to have two RollingFileAppender catching same packages but with different log levels.
I want it.pack.subpack1
, it.pack.subpack2
, it.pack.subpack3
log to two different file appenders, one catching all at DEBUG and above, one catching all at INFO and above.
I did the trick for appB but it doesn't work for appA. Why?
My properties file looks like:
log4j.rootLogger=INFO
#appA INFO file appender
log4j.appender.bocfe=org.apache.log4j.RollingFileAppender
log4j.appender.bocfe.File=${server.log.dir}/bocfe.log
log4j.appender.bocfe.Append=true
log4j.appender.bocfe.Threshold=INFO
log4j.appender.bocfe.MaxFileSize=15MB
log4j.appender.bocfe.MaxBackupIndex=5
log4j.appender.bocfe.layout=org.apache.log4j.PatternLayout
log4j.appender.bocfe.layout.ConversionPattern=%d [%c{1}] %p - %m%n
#appA DEBUG file appender
log4j.appender.bocfe-debug=org.apache.log4j.RollingFileAppender
log4j.appender.bocfe-debug.File=${server.log.dir}/bocfe-debug.log
log4j.appender.bocfe-debug.Append=true
log4j.appender.bocfe-debug.Threshold=DEBUG
log4j.appender.bocfe-debug.MaxFileSize=15MB
log4j.appender.bocfe-debug.MaxBackupIndex=5
log4j.appender.bocfe-debug.layout=org.apache.log4j.PatternLayout
log4j.appender.bocfe-debug.layout.ConversionPattern=%d [%c{1}] %p - %m%n
#appB INFO file appender
log4j.appender.bocws=org.apache.log4j.RollingFileAppender
log4j.appender.bocws.File=${server.log.dir}/bocws.log
log4j.appender.bocws.Append=true
log4j.appender.bocws.Threshold=INFO
log4j.appender.bocws.MaxFileSize=15MB
log4j.appender.bocws.MaxBackupIndex=5
log4j.appender.bocws.layout=org.apache.log4j.PatternLayout
log4j.appender.bocws.layout.ConversionPattern=%d [%c{1}] %p - %m%n
#appB DEBUG file appender
log4j.appender.bocws-debug=org.apache.log4j.RollingFileAppender
log4j.appender.bocws-debug.File=${server.log.dir}/bocws-debug.log
log4j.appender.bocws-debug.Append=true
log4j.appender.bocws-debug.Threshold=DEBUG
log4j.appender.bocws-debug.MaxFileSize=15MB
log4j.appender.bocws-debug.MaxBackupIndex=5
log4j.appender.bocws-debug.layout=org.apache.log4j.PatternLayout
log4j.appender.bocws-debug.layout.ConversionPattern=%d [%c{1}] %p - %m%n
#loggers
log4j.logger.com.eclipsesource.json=DEBUG, bocfe, bocfe-debug
log4j.logger.it.secservizi.boc=DEBUG, bocfe, bocfe-debug
log4j.logger.it.secservizi.abgmf.communication=DEBUG, bocfe, bocfe-debug
log4j.logger.it.sec.ws.boc=DEBUG, bocws, bocws-debug
#additivity
log4j.additivity.com.eclipsesource.json=false
log4j.additivity.it.secservizi.boc=false
log4j.additivity.it.sec.ws.boc=false
log4j.logger.it.secservizi.abgmf.communication=false