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

Add ability to change log level for any class/package dynamically via jmx

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0-rc2
    • Fix Version/s: None
    • Component/s: JMX
    • Labels:
      None

      Description

      Very useful to be able to change the log levels for any logger (i.e. class or package) at runtime in a long lived server process.
      Usually an arbitrary class will not have its own logger configured already so need to create one on the fly in order to specify its log level without everything else picking it up.

      Example simple implementation of a util I created for this attached.
      Takes a loggerName and level and either updates level if existing logger, or configures a new logger using parent appenders if new.
      Not sure where it would best live - possibly org.apache.logging.log4j.core.jmx.LoggerContextAdmin

        Attachments

        1. RootLoggerAdminMBean.patch
          7 kB
          Matt Sicker
        2. LoggerLevelAdminMBean.patch
          8 kB
          phil wray
        3. ExampleJmxLoggerAdmin.java
          2 kB
          phil wray

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              phil.wray phil wray
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: