Separate log file for each AMP and not in alfresco.log

cancel
Showing results for 
Search instead for 
Did you mean: 
signjoy
Active Member II

Separate log file for each AMP and not in alfresco.log

Jump to solution

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
1 Solution

Accepted Solutions
afaust
Master

Re: Separate log file for each AMP and not in alfresco.log

Jump to solution

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).

View solution in original post

4 Replies
afaust
Master

Re: Separate log file for each AMP and not in alfresco.log

Jump to solution

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).

signjoy
Active Member II

Re: Separate log file for each AMP and not in alfresco.log

Jump to solution

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

afaust
Master

Re: Separate log file for each AMP and not in alfresco.log

Jump to solution

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...

signjoy
Active Member II

Re: Separate log file for each AMP and not in alfresco.log

Jump to solution

Great! That worked!

Thanks for your time and help...!