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-666) Ability to use a custom MBean domain
Date Wed, 02 Jul 2014 07:16:25 GMT

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

Remko Popma commented on LOG4J2-666:

Okay, I understand the issue now. 

Yes, if all loggers are made asynchronous by setting {{Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector}},
the loggerContext name is "AsyncLoggerContext" for all web apps. This name is set in the AsyncLoggerContextSelector

We can make this name unique by appending the hashCode of the AsyncLoggerContextSelector class.
I believe that should resolve the issue.

As a side note: please be aware that making all loggers async only works correctly with web
applications if you bundle the log4j2 jar files in WEB-INF/lib in your war file. (See LOG4J2-493).

Meanwhile, the quickest way for you to resolve this is to configure log4j2 differently:
* remove the {{Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector}}
* and, in your log4j2.json configuration, use {{AsyncRoot}} and {{AsyncLogger}} instead of
{{Root}} and {{Logger}}. This also makes the loggers asynchronous, giving you the same performance
benefits, but uses a different mechanism under the hood. This way, the LoggerContext will
be assigned a unique name by the web container.

I'm beginning to think we should update the documentation to recommend that web applications
should avoid the use of {{Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector}}
 and instead configure with {{AsyncRoot}} and {{AsyncLogger}} to avoid these issues...

> Ability to use a custom MBean domain
> ------------------------------------
>                 Key: LOG4J2-666
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-666
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: JMX
>    Affects Versions: 2.0-rc1, 2.0-rc2
>            Reporter: Te L
>            Assignee: Remko Popma
>         Attachments: log4j-mbean-naming.tar.gz
> I have a few webapps codeployed in the same JVM. I'd like to use log4j 2 for all of them
but there is a clash in log4j MBeans since they have a fixed domain . Could we support customizing
the domain for log4j MBeans? I'd like to set a different one for each webapp.
> Thanks,
> Te

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