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

Unloading one webapp unloads JMX MBeans for all webapps

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0-rc1
    • 2.0-rc1
    • JMX
    • 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

              rpopma Remko Popma
              rpopma Remko Popma
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: