You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "David (Jira)" <ji...@apache.org> on 2019/11/11 11:41:00 UTC

[jira] [Commented] (LOG4J2-696) RegexFilter does not match multiline log messages

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

David commented on LOG4J2-696:
------------------------------

Do you work on this issue?

My expected result:

{color:#660e7a}log{color}.warn({color:#008000}"test{color}{color:#000080}\n{color}{color:#008000}"{color});



<{color:#000080}RegexFilter {color}{color:#0000ff}regex{color}{color:#008000}=".*test.*" {color}{color:#0000ff}onMatch{color}{color:#008000}="DENY" {color}{color:#0000ff}onMismatch{color}{color:#008000}="ACCEPT"{color}/>

should not log "test". But it is logging test.

Without the \n the RegexFilter is working.

> RegexFilter does not match multiline log messages
> -------------------------------------------------
>
>                 Key: LOG4J2-696
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-696
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Filters
>    Affects Versions: 2.0-rc2
>            Reporter: phil wray
>            Assignee: Ralph Goers
>            Priority: Major
>         Attachments: RegexFilterTest.java
>
>
> RegexFilter is constructed with a pattern, but pattern does not support multiline matches, so impossible for the filter to ever match a multiline msg.
> Should maybe provide a multline="x attribute whichi should default to true and result in the patter being compiled as such:
> Pattern pattern = Pattern.compile(".*line.*", Pattern.DOTALL);
> See attached UnitTest illustrating failure



--
This message was sent by Atlassian Jira
(v8.3.4#803005)