Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Logging Configuration Not working

Avatar

Level 2

I have override logger configuration 'org.apache.sling.commons.log.LogManager.config' under apps through the code and it is not picked up by server.I can see in felix console the older values of the config which are present by default.I have restarted the bundle also but its not working.
Moreover, can anyone guide me how to implement rotation of logs.I have created logger config and writer config but its not working.

5 Replies

Avatar

Level 4

Hi, Rohit.

I usually add only a factory configuration containing the file name, the log level and the packages/classes being logged, as you can see here:

https://github.com/daniel-lima/samples-aem-less-debug/blob/master/content/src/main/content/jcr_root/...

Most of the time, this is enough.
On rare occasions, I had to restart my AEM instance so the changes could take place, but that is not the regular case.

Regards,

Daniel.

Avatar

Level 2

Hi Daniel,

Thanks for your quick reply.I have done that before only and its working but what I need was to implement version rotation of logs and for that I was overriding ''org.apache.sling.commons.log.LogManager.config' config to give the max file size of logs and I have done that but its not working.

Avatar

Level 4

Hi Rohit

Please check this configuration "org.apache.sling.commons.log.LogManager.factory.writer".

Thanks,

Vamsi

Avatar

Level 4

Hi, Rohit.

Under /apps/<<yoursite>>/config or /apps/<<yoursite>>/config.<<runmode>>, try to create a node org.apache.sling.commons.log.LogManager.factory.writer-<<yoursite>>, with the following properties:

org.apache.sling.commons.log.file="../logs/yoursite.log"
org.apache.sling.commons.log.file.number="{Long}5"
org.apache.sling.commons.log.file.size="400MB"

Or the corresponding vault file (org.apache.sling.commons.log.LogManager.factory.writer-<<yoursite>>/.content.xml), with the following content:

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" jcr:primaryType="sling:OsgiConfig" org.apache.sling.commons.log.file="../logs/yoursite.log" org.apache.sling.commons.log.file.number="{Long}5" org.apache.sling.commons.log.file.size="400MB"/>


I think the log.file here must match the log.file the in other factory configuration node...

There is an example here: https://github.com/Adobe-Marketing-Cloud/aem-translation-framework-bootstrap-connector/blob/master/c...

Regards,

Daniel.