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

Unloading one webapp unloads JMX MBeans for all webapps

    Details

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

      Description

      As a stopgap solution for LOG4J2-406, all MBeans are unregistered when a LoggerContext is stopped.

      In an application server, multiple web applications can be deployed and undeployed independently and a better solution would only unregister the MBeans associated with the web application that is being undeployed.

      Current MBean ObjectNames look like this (simplified):

      ...StatusLogger
      ...ContextSelector
      ...LoggerContext,ctx=%s
      ...LoggerConfig,ctx=%s,name=%s
      ...Appender,ctx=%s,name=%s
      ...
      

      Assuming that every web application has a unique name, and this name becomes the name of the LoggerContext, then one solution would be to create StatusLogger and ContextSelector MBeans that have the LoggerContext name in their ObjectName:

      ...StatusLogger,ctx=%s
      ...ContextSelector,ctx=%s
      ...LoggerContext,ctx=%s
      ...LoggerConfig,ctx=%s,name=%s
      ...Appender,ctx=%s,name=%s
      ...
      

      This way, every web application would have its own StatusLogger and ContextSelector MBeans. The MBeans may point to the same (shared) underlying StatusLogger and ContextSelector objects. When a web application is undeployed, unregistering all MBeans associated with the LoggerContext will not affect any MBeans associated with another web application (which has it own, separate, LoggerContext).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                remkop@yahoo.com Remko Popma
                Reporter:
                remkop@yahoo.com Remko Popma
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: