Log4j 2
  1. Log4j 2
  2. LOG4J2-234

RegexFilter crashes as context-wide filter

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-beta5
    • Fix Version/s: 2.0-beta6
    • Component/s: Filters
    • Labels:
      None

      Description

      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

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        1d 19h 19m 1 Ralph Goers 04/May/13 07:59
        Resolved Resolved Closed Closed
        2h 47m 1 Gerald Kroisandt 04/May/13 10:47
        Gerald Kroisandt made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Hide
        Gerald Kroisandt added a comment -

        I looked at the source code and in my opinion it should work now

        Show
        Gerald Kroisandt added a comment - I looked at the source code and in my opinion it should work now
        Ralph Goers made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Ralph Goers [ ralph.goers@dslextreme.com ]
        Fix Version/s 2.0-beta6 [ 12324340 ]
        Resolution Fixed [ 1 ]
        Hide
        Ralph Goers added a comment -

        Thanks for the bug report! The fix was applied in revision 1479050. Please verify and close.

        Show
        Ralph Goers added a comment - Thanks for the bug report! The fix was applied in revision 1479050. Please verify and close.
        Gerald Kroisandt created issue -

          People

          • Assignee:
            Ralph Goers
            Reporter:
            Gerald Kroisandt
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 10m
              10m
              Remaining:
              Remaining Estimate - 10m
              10m
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development