Return-Path: X-Original-To: apmail-logging-log4j-dev-archive@www.apache.org Delivered-To: apmail-logging-log4j-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8C38C112C1 for ; Wed, 2 Jul 2014 07:16:30 +0000 (UTC) Received: (qmail 11852 invoked by uid 500); 2 Jul 2014 07:16:25 -0000 Delivered-To: apmail-logging-log4j-dev-archive@logging.apache.org Received: (qmail 11794 invoked by uid 500); 2 Jul 2014 07:16:25 -0000 Mailing-List: contact log4j-dev-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Developers List" Reply-To: "Log4J Developers List" Delivered-To: mailing list log4j-dev@logging.apache.org Received: (qmail 11784 invoked by uid 99); 2 Jul 2014 07:16:25 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Jul 2014 07:16:25 +0000 Date: Wed, 2 Jul 2014 07:16:25 +0000 (UTC) From: "Remko Popma (JIRA)" To: log4j-dev@logging.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LOG4J2-666) Ability to use a custom MBean domain MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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 class. 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}} setting * 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 (v6.2#6252) --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-dev-help@logging.apache.org