[ 
https://issues.apache.org/jira/browse/SLING-7529?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16394932#comment-16394932
 ] 

ASF GitHub Bot commented on SLING-7529:
---------------------------------------

chetanmeh commented on issue #3: SLING-7529 - implemented layout inheritance in 
log encoder
URL: 
https://github.com/apache/sling-org-apache-sling-commons-log/pull/3#issuecomment-372222722
 
 
   @CptBartender Can you add license headers on the newly added files in test. 
Without that build fails for `mvn verfiy` in RAT check

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> 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