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

Provide enhanced logger filtering support.


    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0-alpha1
    • Component/s: Core
    • Labels:


      We wrote our own logging framework primarily because log4j didn't provide some of the features we needed. Our software runs on behalf of many companies, products and users all in the same JVM. We have a requirement to be able to enable logging based on some of these factors. For example, we might want to enable debug logging only for a specific company or even a specific user. All our requests store attributes, such as the companyId, product name and userid in the MDC.

      So the real requirement here is to be able to filter log records early based on more information than just the log level. For example, our requirement could be met by a filter that could be configured to associate a log level with a company id. Then when debug is called a check would first be done to see if debug was enabled for that company id and then whether debug was enabled for that logger. These checks cannot be done as filters on Appenders as the performance of the system is dramatically impacted as isDebugLogging really needs to return false for all company ids other than the one that is enabled.

      This feature is similar to LogBack's TurboFilter, except I would like it implemented differently. I would recommend that the filter be specified globally but referenced on each logger to which it applies, much as the specification of Appenders is done.




            • Assignee:
              ralph.goers@dslextreme.com Ralph Goers
              ralph.goers@dslextreme.com Ralph Goers
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: