Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Logging Configuration Not working

rohitg22171791
Level 2
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.

1 Reply
daniel_henriqu1
Level 4
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.

rohitg22171791
Level 2
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.

vjetty
Level 4
Level 4

Hi Rohit

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

Thanks,

Vamsi

daniel_henriqu1
Level 4
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.