Overriding of default logger functionality to support min file size / daily rotation | Community
Skip to main content
binoyp6992037
New Participant
June 12, 2021
Solved

Overriding of default logger functionality to support min file size / daily rotation

  • June 12, 2021
  • 2 replies
  • 1116 views

Is there any way to have the logger support rotation in a way that it picks either min file size / daily rotation whichever comes first ?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Asutosh_Jena_

Hi @binoyp6992037 

 

The way sling logging is setup you could either use scheduled rotation or size based rotation, both can not be used simultaneously in a single configuration.

There are more details around the loggers in sling documentation here


The best practice per say:

  1. You need to have proper logging level set for the production instances so that the right amount of required logging happens, no noise is logged.
  2. For instances lower than production it makes more sense to have size based rotation as those logs are usually required for debug purposes so the amount of logging tends to increase if you use daily rotation. And it becomes difficult to process those huge files with normal text editors.

Thanks!

2 replies

Bhuwan_B
New Participant
June 13, 2021

@binoyp6992037 Please give a try by having two writer configuration for same logger file, one with scheduled configuration and another with size configuration.

 

https://www.youtube.com/watch?v=rwRozch4OYo

http://www.sgaemsolutions.com/2019/12/aem-logs-in-detail-part-2.html

 

Asutosh_Jena_
Asutosh_Jena_Accepted solution
New Participant
June 13, 2021

Hi @binoyp6992037 

 

The way sling logging is setup you could either use scheduled rotation or size based rotation, both can not be used simultaneously in a single configuration.

There are more details around the loggers in sling documentation here


The best practice per say:

  1. You need to have proper logging level set for the production instances so that the right amount of required logging happens, no noise is logged.
  2. For instances lower than production it makes more sense to have size based rotation as those logs are usually required for debug purposes so the amount of logging tends to increase if you use daily rotation. And it becomes difficult to process those huge files with normal text editors.

Thanks!