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

JUL adapter ignores log filters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.13.3
    • 2.14.0
    • JUL adapter
    • None
    • 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

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ebourg Emmanuel Bourg
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              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