Gerald Kroisandt created LOG4J2-234:
---------------------------------------

             Summary: RegexFilter crashes as context-wide filter
                 Key: LOG4J2-234
                 URL: https://issues.apache.org/jira/browse/LOG4J2-234
             Project: Log4j 2
          Issue Type: Bug
          Components: Filters
    Affects Versions: 2.0-beta5
            Reporter: Gerald Kroisandt


If a RegexFilter is used as a context-wide filter,
then a call like
  logger.isDebugEnabled()
leads to a Null-Pointer-Exception, because the RegexFilter is called with the 
message "null".
The stack-trace (2.0-beta5) is:
        at 
org.apache.logging.log4j.core.filter.RegexFilter.filter(RegexFilter.java:60)
        at 
org.apache.logging.log4j.core.filter.CompositeFilter.filter(CompositeFilter.java:176)
        at 
org.apache.logging.log4j.core.Logger$PrivateConfig.filter(Logger.java:317)
        at org.apache.logging.log4j.core.Logger.isEnabled(Logger.java:128)
        at 
org.apache.logging.log4j.spi.AbstractLogger.isTraceEnabled(AbstractLogger.java:1129)


In the MarkerFilter is the code
  return marker != null && ...
i.e. it is only necessary to change line 60 to
  return msg != null && filter(msg.toString)
in RegexFilter (I do not know how to do this correctly...)

In line 77, this check is done; in line 66 and 72 the same problem may arise...

Greetings,
Gerald Kroisandt


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to