logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Remko Popma (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4J2-500) Unloading one webapp unloads JMX MBeans for all webapps
Date Fri, 07 Feb 2014 03:12:21 GMT

    [ https://issues.apache.org/jira/browse/LOG4J2-500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13894151#comment-13894151

Remko Popma commented on LOG4J2-500:

The new ObjectNames correctly separate MBeans for multiple web applications. Unloading a webapp
now correctly unregisters the MBeans for only that LoggerContext.

Two items remain: 
# (at least in Tomcat 7.0.50 and 8.0.1) listeners and filters need to be configured in web.xml
in order for the Log4j2 MBeans to be unregistered when the web application is undeployed.
We expected that to happen automatically in Servlet 3.0 containers. LOG4J2-529 was created
to track this issue.
# The Log4J2 JMX GUI needs to dynamically update and add/remove the relevant tabs when MBeans
for a LoggerContext are registered/unregistered. I'll create a separate Jira ticket to track
this issue.

> Unloading one webapp unloads JMX MBeans for all webapps
> -------------------------------------------------------
>                 Key: LOG4J2-500
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-500
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: JMX
>    Affects Versions: 2.0-rc1
>            Reporter: Remko Popma
>            Assignee: Remko Popma
> 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,

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org

View raw message