You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2014/07/07 15:08:34 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=14053631#comment-14053631 ] 

Gary Gregory commented on LOG4J2-696:
-------------------------------------

We might not be able to use {{org.apache.logging.log4j.core.config.plugins.util.TypeConverters.PatternConverter}} if we want to support the int flag for {{java.util.regex.Pattern.compile(String, int)}}.

It seems the solution is to change {{org.apache.logging.log4j.core.filter.RegexFilter.createFilter(Pattern, Boolean, Result, Result)}} and either:

- Add an int parameter and let user compute the flag themselves, or
- Add a String parameter and allow users to say things like "CASE_INSENSITIVE | MULTILINE" but that means parsing such things.

Perhaps we should just start with an int flag.

Thoughts?

> 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
>         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
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


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

Posted by Matt Sicker <bo...@gmail.com>.
An int flag could make sense, though an enum would work, too. Darn API
improvements that can't be done in the JDK!


On 7 July 2014 08:08, Gary Gregory (JIRA) <ji...@apache.org> wrote:

>
>     [
> https://issues.apache.org/jira/browse/LOG4J2-696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14053631#comment-14053631
> ]
>
> Gary Gregory commented on LOG4J2-696:
> -------------------------------------
>
> We might not be able to use
> {{org.apache.logging.log4j.core.config.plugins.util.TypeConverters.PatternConverter}}
> if we want to support the int flag for
> {{java.util.regex.Pattern.compile(String, int)}}.
>
> It seems the solution is to change
> {{org.apache.logging.log4j.core.filter.RegexFilter.createFilter(Pattern,
> Boolean, Result, Result)}} and either:
>
> - Add an int parameter and let user compute the flag themselves, or
> - Add a String parameter and allow users to say things like
> "CASE_INSENSITIVE | MULTILINE" but that means parsing such things.
>
> Perhaps we should just start with an int flag.
>
> Thoughts?
>
> > 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
> >         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
> (v6.2#6252)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>
>


-- 
Matt Sicker <bo...@gmail.com>