cancel
Showing results for 
Search instead for 
Did you mean: 

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

signjoy
Confirmed Champ
Confirmed Champ

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 ACCEPTED ANSWER

afaust
Legendary Innovator
Legendary Innovator

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 answer in original post

4 REPLIES 4

afaust
Legendary Innovator
Legendary Innovator

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
Confirmed Champ
Confirmed Champ

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
Legendary Innovator
Legendary Innovator

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
Confirmed Champ
Confirmed Champ

Great! That worked!

Thanks for your time and help...!