Log4j Additivity
I have this log4j property and I want the rootLogger not to duplicate messages from other apps, I tried with additivity but it doesn't work.
Any help?
**log4j.additivity.appender.appenderProcesoWREG=false**
log4j.rootLogger=INFO, file
log4j.appender.file.File = C\:\\datos\\logs\\loging.log
log4j.logger.org.apache.struts2=ERROR
log4j.logger.com.opensymphony.xwork2=ERROR
log4j.logger.ognl=ERROR
log4j.appender.file = org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.DatePattern = '.'yyyy-MM-dd'.log'
log4j.appender.file.layout = org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern = %d{dd/MM HH:mm:ss} %-5p ([%-30F]:%-30M) = %m %n
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern = %d %p [%t, %c] - %m%n
log4j.appender.appenderProcesoWreg = org.apache.log4j.DailyRollingFileAppender
log4j.appender.appenderProcesoWreg.File = C\:\\OEGAM_FILES\\FICHEROS_LOGS\\PROCESO_WREG\\LOCAL\\procesoWreg.log
log4j.appender.appenderProcesoWreg.layout = org.apache.log4j.PatternLayout
log4j.appender.appenderProcesoWreg.layout.ConversionPattern = %d{dd/MM HH:mm:ss} %-5p ([%-30F]:%-30M) = %m %n
log4j.logger.ProcesoWreg = INFO,appenderProcesoWreg
+3
source to share
1 answer
The problem was this:
log4j.additivity.appender.appenderProcesoWREG = false
I changed it to:
log4j.appender.appenderProcesoWreg = org.apache.log4j.DailyRollingFileAppender
log4j.appender.appenderProcesoWreg.File = C\:\\OEGAM_FILES\\FICHEROS_LOGS\\PROCESO_WREG\\LOCAL\\procesoWreg.log
log4j.appender.appenderProcesoWreg.layout = org.apache.log4j.PatternLayout
log4j.appender.appenderProcesoWreg.layout.ConversionPattern = %d{dd/MM HH:mm:ss} %-5p ([%-30F]:%-30M) = %m %n
log4j.logger.ProcesoWreg = INFO,appenderProcesoWreg
log4j.additivity.PocesoWreg = false
And it works great
+1
source to share