04-05-2018 02:09 PM
Hi,
I have below setting in my AMP's log4j.properties file. The below setting works fine and creates a separate log file named amp_abc.log. The only problem is the AMP specific log goes to both the files alfresco.log and amp_abc.log file.
Is there any way so that the logs goes only to the AMP specific log file and not in alfresco.log too.
log4j.appender.moduleLog=org.apache.log4j.DailyRollingFileAppender
log4j.appender.moduleLog.File=amp_abc.log
log4j.appender.moduleLog.layout=org.apache.log4j.PatternLayout
log4j.appender.moduleLog.layout.ConversionPattern=%d{yyyy-MM-dd} %d{ABSOLUTE} %-5p [%c] [%t] %m%n
log4j.logger.com.abc.component=debug,moduleLog
04-06-2018 03:04 AM
You have to configure the "additivity" of your logger to false to no longer make it propagate logging events to inherited appenders (the alfresco.log is an appender inherited from the root).
04-06-2018 03:04 AM
You have to configure the "additivity" of your logger to false to no longer make it propagate logging events to inherited appenders (the alfresco.log is an appender inherited from the root).
04-06-2018 08:48 AM
Thanks for your reply Axel Faust
I tried the below line in my AMP log4j.properties file but it is still putting logs in parent log file.
log4j.additivity.moduleLog=false
04-06-2018 09:14 AM
You do not define the additivity for the appender, you have to define it for the logger package.
log4j.additivity.com.abc.component=false
Then, every logger in the com.abc.component package will only log to the appender you specified (moduleLog) and not propagate further up...
04-06-2018 10:10 AM
Great! That worked!
Thanks for your time and help...!
Explore our Alfresco products with the links below. Use labels to filter content by product module.