[ 
https://issues.apache.org/jira/browse/SLING-7529?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chetan Mehrotra reassigned SLING-7529:
--------------------------------------

    Assignee: Chetan Mehrotra

> Log message layouts are not property inherited
> ----------------------------------------------
>
>                 Key: SLING-7529
>                 URL: https://issues.apache.org/jira/browse/SLING-7529
>             Project: Sling
>          Issue Type: Bug
>          Components: Commons
>    Affects Versions: Commons Log 5.1.2
>            Reporter: Fryderyk Wysocki
>            Assignee: Chetan Mehrotra
>            Priority: Major
>
> Steps to reproduce on AEM 6.3 with Apache Sling Commons Log 5.1.2:
> 1. Create Logger Configuration for Logger "my.project", log file "error.log", 
> log level 'Information" and message pattern "My project: \{5}"
> 2. Create an Slf4J logger for class my.project.Sample and use it to infolog 
> message "test foo"
> 3. Change the configuration created in step 1 - update logger to 
> "my.project.Sample"
> 4. Use the logger created in step 2 to infolog message "test bar"
> Expected result:
> 5. error.log file would contain messages "My project: test foo" and "My 
> project: test bar"
> Actual result:
> 5. error.log file contains the message "test foo" in the format configured as 
> the default format, but also contains the message "My project: test bar" - 
> the second message, in the appropriate format.
> Investigation:
> Checking the source code, I've discovered the following in class 
> 'LoggerSpecificEncoder', starting from line 47:
> {code:java}
>     private Layout<ILoggingEvent> getLayout(String loggerName) {
>         // TODO Handle layout inheritance wrt logger names
>         Layout<ILoggingEvent> layout = layoutByCategory.get(loggerName);
>         if (layout == null) {
>             layout = defaultLayout;
>         }
>         return layout;
>     }
> {code}
> Which means that, unless the configuration is created for the exact logger 
> name, the default one will be used - the functionality is not broken, but 
> simply not implemented.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to