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 7ACD011C5B for ; Wed, 13 Aug 2014 12:52:12 +0000 (UTC) Received: (qmail 97189 invoked by uid 500); 13 Aug 2014 12:52:12 -0000 Delivered-To: apmail-logging-log4j-dev-archive@logging.apache.org Received: (qmail 97153 invoked by uid 500); 13 Aug 2014 12:52:12 -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 97143 invoked by uid 99); 13 Aug 2014 12:52:11 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Aug 2014 12:52:11 +0000 Date: Wed, 13 Aug 2014 12:52:11 +0000 (UTC) From: "Remko Popma (JIRA)" To: log4j-dev@logging.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LOG4J2-774) NdcPatternConverter brakes Log4j 1.2.x layout MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LOG4J2-774?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1409= 5429#comment-14095429 ]=20 Remko Popma commented on LOG4J2-774: ------------------------------------ AFAICS, log4perl is the only logging package that actually documents the %x= output format. However, it seems that both [log4net|http://stackoverflow.com/questions/334= 367/when-to-use-nested-diagnostic-context-ndc] and [log4perl|http://log4per= l.sourceforge.net/releases/Log-Log4perl/docs/html/Log/Log4perl.html#085cb] = also format the %x pattern as a space-separated list without enclosing brac= kets. I kind of like log4perl's example usage: {code} Log::Log4perl::NDC->push("San"); Log::Log4perl::NDC->push("Francisco"); $logger->debug("rocks"); //PatternLayout format like ``%x %m%n'' will give output: San Francisco rocks {code} Given that three other logging packages use the space-separated format I wo= uldn't mind making that the default. We can add formatting options to use t= he comma-separated format enclosed by brackets. Gary, what do you think? > NdcPatternConverter brakes Log4j 1.2.x layout > --------------------------------------------- > > Key: LOG4J2-774 > URL: https://issues.apache.org/jira/browse/LOG4J2-774 > Project: Log4j 2 > Issue Type: Bug > Components: Layouts > Affects Versions: 2.0.1 > Reporter: Frank Wi=C3=9Fmann > Assignee: Remko Popma > Priority: Minor > Labels: patch > Fix For: 2.0.2 > > Attachments: NdcPatternConverter.java.patch > > > In Log4j 1.2.17 NdcPatternConverter.format() returns an empty string "" o= r the stack messages separated by space "a b c" (NDC.DiagnosticContext.full= Message). > The PatternLayout \[%20.20x\] results in=20 > {code}[ ]{code} or {code}[ a b c]{code}. > In Log4j 2.0.1 NdcPatternConverter.format() returns an unmodified Collect= ion.toString() representation: "\[\]" for an empty collection or the collec= tion separated by comma "\[a, b, c\]" (DefaultThreadContextStack.toString()= and MutableThreadContextStack.toString()). > The PatternLayout \[%20.20x\] results in {code}[ []]{cod= e} or {code}[ [a, b, c]]{code}. -- 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