Log4j 2
  1. Log4j 2
  2. LOG4J2-500

Unloading one webapp unloads JMX MBeans for all webapps

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major 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).

        Issue Links

          Activity

          Remko Popma created issue -
          Remko Popma made changes -
          Field Original Value New Value
          Link This issue relates to LOG4J2-406 [ LOG4J2-406 ]
          Remko Popma made changes -
          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.
          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):
          {code}
          ...StatusLogger
          ...ContextSelector
          ...LoggerContext,ctx=%s
          ...LoggerConfig,ctx=%s,name=%s
          ...Appender,ctx=%s,name=%s
          ...
          {code}

          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:
          {code}
          ...StatusLogger,ctx=%s
          ...ContextSelector,ctx=%s
          ...LoggerContext,ctx=%s
          ...LoggerConfig,ctx=%s,name=%s
          ...Appender,ctx=%s,name=%s
          ...
          {code}

          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).
          Remko Popma made changes -
          Assignee Remko Popma [ remkop@yahoo.com ]
          Remko Popma made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Remko Popma made changes -
          Link This issue depends upon LOG4J2-529 [ LOG4J2-529 ]
          Remko Popma made changes -
          Link This issue relates to LOG4J2-530 [ LOG4J2-530 ]
          Remko Popma made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Fix Version/s 2.0-rc1 [ 12325011 ]
          Resolution Fixed [ 1 ]
          Remko Popma made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Remko Popma made changes -
          Link This issue relates to LOG4J2-578 [ LOG4J2-578 ]
          Remko Popma made changes -
          Link This issue relates to LOG4J2-666 [ LOG4J2-666 ]

            People

            • Assignee:
              Remko Popma
              Reporter:
              Remko Popma
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development