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

ASF GitHub Bot commented on LOG4J2-2123:
----------------------------------------

GitHub user jacobtolar opened a pull request:

    https://github.com/apache/logging-log4j2/pull/135

    [LOG4J2-2123] DefaultMergeStrategy did not merge filters on loggers 
correctly

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jacobtolar/logging-log4j2 LOG4J2-2123

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/logging-log4j2/pull/135.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #135
    
----
commit ce528d47781cd173cf0b6bb7556cb8569f90de5d
Author: Jacob Tolar <[email protected]>
Date:   2017-11-21T18:08:59Z

    [LOG4J2-2123] DefaultMergeStrategy did not merge filters on loggers 
correctly

----


> logger filter in composite logger not combined properly
> -------------------------------------------------------
>
>                 Key: LOG4J2-2123
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2123
>             Project: Log4j 2
>          Issue Type: Bug
>            Reporter: Jacob Tolar
>
> When using a composite logger with DefaultMergeStrategy, logger filters 
> aren't combined properly. 
> Specifically, if the 'parent' configuration for the logger has no filter and 
> the child configuration does, all attributes and children of the child filter 
> are dropped from the composite configuration. 
> For example, if my parent logger has:
> {code}
>     <Loggers>
>         <Logger name="cat1" level="debug" additivity="false">
>             <AppenderRef ref="File"/>
>         </Logger>
> {code}
> and the child logger has:
> {code}
>     <Loggers>
>         <Logger name="cat1" level="debug" additivity="false">
>             <RegexFilter regex=".*TEST.*" onMatch="DENY" onMismatch="ACCEPT" 
> />
>             <AppenderRef ref="File"/>
>         </Logger>
> {code}
> DefaultMergeStrategy creates a RegexFilter node in the composite 
> configuration with no attributes. You end up getting a message like this when 
> the RegexFilter is constructed:
> {code}
> 2017-11-21 12:02:26,733 main ERROR A regular expression must be provided for 
> RegexFilter
> {code}
> Here: 
> https://github.com/apache/logging-log4j2/blob/master/log4j-core/src/main/java/org/apache/logging/log4j/core/config/composite/DefaultMergeStrategy.java#L172-L174
> A new copy of the filter node is created, but the children and attributes 
> aren't added to the new nodes.
> If the parent logger config does have a filter, it looks like it works 
> correctly.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to