Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-2882

JUL adapter ignores log filters

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.13.3
    • Fix Version/s: 2.14.0
    • Component/s: JUL adapter
    • Labels:
      None
    • Flags:
      Patch

      Description

      Setting a java.util.logging.Filter on a logger has no effect when the JUL adapter is used. For example with:

              Logger logger = new CoreLoggerAdapter().getLogger("test");
              logger.setFilter(record -> false);
              logger.info("Test");
      

      the message is still logged.

      org.apache.logging.log4j.jul.ApiLogger does check the filter in its log(LogRecord) method, but the other log methods bypass it and call directly the underlying log4j logger.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ebourg Emmanuel Bourg

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h

                  Issue deployment