Highlighted

Two or more custom logs - AEM

Avatar

Avatar

Singaiah_Chintalapudi

MVP

Avatar

Singaiah_Chintalapudi

MVP

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

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

02-05-2018

For information about how logging works within AEM - see  -- Logging

Highlighted

Avatar

Avatar

Singaiah_Chintalapudi

MVP

Avatar

Singaiah_Chintalapudi

MVP

Singaiah_Chintalapudi
MVP

02-05-2018

It did not explain about the multiple custom logs. This is a general documentation about configuring a custom log.

Highlighted

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

02-05-2018

I am seeing no AEM docs that suggests multiple logs can be used.

You can configure AEM to log to custom logs too -- see this community artilce - CQ Logs - CQ Tutorials 

or - Monitoring and Maintaining Your CQ instance

Highlighted

Avatar

Avatar

Singaiah_Chintalapudi

MVP

Avatar

Singaiah_Chintalapudi

MVP

Singaiah_Chintalapudi
MVP

02-05-2018

Thanks Scott! We have already configured the custom log and looking to configure second custom log.

Highlighted

Avatar

Avatar

Singaiah_Chintalapudi

MVP

Avatar

Singaiah_Chintalapudi

MVP

Singaiah_Chintalapudi
MVP

02-05-2018

The above docs are talking about customizing single log.

Highlighted

Avatar

Avatar

Singaiah_Chintalapudi

MVP

Avatar

Singaiah_Chintalapudi

MVP

Singaiah_Chintalapudi
MVP

02-05-2018

Can you give me some guidance?

Highlighted

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

02-05-2018

Using 2 logs is not documented in any doc or article. I am checking internally.

Highlighted

Avatar

Avatar

Veena_Vikram

MVP

Avatar

Veena_Vikram

MVP

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

Avatar

Avatar

Singaiah_Chintalapudi

MVP

Avatar

Singaiah_Chintalapudi

MVP

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.