Highlighted

Two or more custom logs - AEM

Singaiah_Chintalapudi

MVP

02-05-2018

Hi,

Currently, we have a custom log name (org.apache.sling.commons.log.LogManager.factory.config-customLog1): custom-log1.log and logging all the details for: com.gemotrixx.aem

I have created another logger (org.apache.sling.commons.log.LogManager.factory.config-customLog2) name is: custom-log2.log and logging com.geometrixx.aem.core.newfunctionality details.

When I run the new functionality, it should log details to both logs but its logging into only the second log.

I am getting the logger : Logger log = LoggerFactory.getLogger(getClass());

Can we get a specific logger instance to log the details as mentioned in below post?

1478125_pastedImage_7.png

Can you someone help me to understand this?

Thanks

Replies

Highlighted
Highlighted
Highlighted

Veena_Vikram

MVP

02-05-2018

Hi Noksc

    When I implement multiple logs I make sure it is pointing to two seperate packages. As I can see ur customlog1 is parent package of customlog2. So it is pretty obvious that anything under com.geometrixx.aem.core.newfunctionality will be specifically written to your second log as it is more precise.

Lets say you need to log a particular class logs to separate log, then you shud create a customlog with that class path .

In your case, the second log is more precise and anything inside the above package will be printed in your second log.

Thanks

Veena

Highlighted

Singaiah_Chintalapudi

MVP

02-05-2018

Hi Veena_07,

Thanks for your explanation. I am assuming that all the classes under com.geometrixx.aem.core.newfunctionality should send the logs to both custom logs. However, they are logging only to custom-log2.log. I didn't find any doc on how logger selects the particular log file to log the messages.

Thanks.