Return-Path: X-Original-To: apmail-logging-log4j-user-archive@www.apache.org Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 897F411ECD for ; Sun, 3 Aug 2014 05:57:54 +0000 (UTC) Received: (qmail 20379 invoked by uid 500); 3 Aug 2014 05:57:53 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 20333 invoked by uid 500); 3 Aug 2014 05:57:53 -0000 Mailing-List: contact log4j-user-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Users List" Reply-To: "Log4J Users List" Delivered-To: mailing list log4j-user@logging.apache.org Received: (qmail 20317 invoked by uid 99); 3 Aug 2014 05:57:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Aug 2014 05:57:53 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ralph.goers@dslextreme.com designates 209.85.220.50 as permitted sender) Received: from [209.85.220.50] (HELO mail-pa0-f50.google.com) (209.85.220.50) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Aug 2014 05:57:49 +0000 Received: by mail-pa0-f50.google.com with SMTP id et14so8213810pad.9 for ; Sat, 02 Aug 2014 22:57:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:content-type:mime-version:subject :in-reply-to:date:content-transfer-encoding:message-id:references:to; bh=yKjMNDOhDdef+0223zG2AOPWwtRizxjO1+QnCyWPypE=; b=PYEsIMJ7ETPyd9INZBKLZM9RmI5DdKTgg/qLngbkAi9x27aoH78fnkBUg4WhLLtnDU LaUXUTnSrl/YeuXtnzTdbKO21SF3aNovVzjPv7pUVSg2zGWPfXEtcnYHcylXP4Jjb6YY 2vASJT5aZ4f1cIvz0HCTtatT3jbAbFkBeTG+CWt6TZoMolSDs8WQ5NOTTXSwNp1cnyrs kR/xTrn7XRi9Iqs2JX4d/0Lr4XBQB1t0KilFLVr7uaN7CnirGsP80zvXAnTyJgZsTu/+ Cdp1FoNOU9Uhni/t9QNGB6sP8Y1tUuyspePzTFU2WigIkDY6nFa9ATMgqBflDObgq5Z0 ZbIA== X-Gm-Message-State: ALoCoQnHY6WrmNNEXn0ynK4IGP1eUTcV1Cf3e4qMRyKPJmy4lHX+JK80vc3UdKtmCCh1+jUnjyMp X-Received: by 10.70.90.237 with SMTP id bz13mr624628pdb.110.1407045443980; Sat, 02 Aug 2014 22:57:23 -0700 (PDT) Received: from [192.168.1.68] (99-180-69-21.lightspeed.irvnca.sbcglobal.net. [99.180.69.21]) by mx.google.com with ESMTPSA id oz7sm11227745pdb.77.2014.08.02.22.57.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 02 Aug 2014 22:57:23 -0700 (PDT) From: Ralph Goers X-Google-Original-From: Ralph Goers Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: log4j 2.0 - About StatusLogger logging level and console output In-Reply-To: Date: Sat, 2 Aug 2014 22:57:25 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <180F3148-3581-48B8-8EE3-BEB27F4A466B@dslextreme.com> References: <53DA6B11.3080203@gmail.com> <53DB3E7A.8010607@gmail.com> To: Log4J Users List X-Mailer: Apple Mail (2.1878.6) X-Virus-Checked: Checked by ClamAV on apache.org What he may really want is a way to register the console listener = earlier - via a system property. Ralph On Aug 1, 2014, at 12:24 AM, Remko Popma wrote: > Ok. Take a look at the system properties section of the Configuration = manual page. There seem to be two settings. I'm not sure which to use: = Log4jDefaultStatusLevel or log4j2.StatusLogger.level.=20 >=20 > Sent from my iPhone >=20 >> On 2014/08/01, at 16:15, Marco Cosentino = wrote: >>=20 >> Hi Remko, >> thanks for the reply. >> I'd still like something which can be enabled through system = preoperties and logs at very early stages, for example, where the config = is read from. >>=20 >> Marco. >>=20 >>> On 08/01/2014 12:04 AM, Remko Popma wrote: >>> All you need to do is set status=3D"trace" in your log4j2.xml config = file. >>>=20 >>> So the beginning of your config looks like this: >>> >>=20 >>> Sent from my iPhone >>>=20 >>>> On 2014/08/01, at 1:13, Marco Cosentino = wrote: >>>>=20 >>>> Hi, >>>> I'm trying to get log4j 2.0 debug information printed out in the = console but I couldn't manage to get them. >>>> In log4j 1.x you would set the system property "log4j.debug". >>>>=20 >>>> I thought that the mechanism was similar in log4j 2.x and = apparently it should be by setting >>>> log4j2.StatusLogger.level=3DDEBUG >>>>=20 >>>> Still nothing, so I dug a little bit in the code and found that the = StatusLogger logs its messages either to the listeners (if there's at = least one) or to a SimpleLogger (logger) which is initialized in the = constructor (method StatusLogger#logMessage()). >>>>=20 >>>> I found that there was a JMX listener registered so I disabled JMX = beans with >>>> log4j2.disable.jmx=3Dtrue >>>> but still no luck: the messages don't appear in the console. >>>>=20 >>>> I noticed though that the constructor might be the source of the = problem: >>>>=20 >>>> private StatusLogger() { >>>> this.logger =3D new SimpleLogger("StatusLogger", Level.ERROR, = false, true, false, false, Strings.EMPTY, null, PROPS, >>>> System.err); >>>> this.listenersLevel =3D Level.toLevel(DEFAULT_STATUS_LEVEL, = Level.WARN).intLevel(); >>>> } >>>>=20 >>>> The SimpleLogger is initialized using level ERROR therefore the = isEnabled implementation in StatusLogger returns the logging level of = this.logger which is always ERROR even if I wanted DEBUG. >>>>=20 >>>> Would it make sense to use DEFAULT_STATUS_LEVEL to actually set the = level into the SimpleLogger constructor? >>>> Why is it so hard to get debug messages showing up in the console = (I mean disable JMX and set the property to DEBUG)? >>>>=20 >>>> Best, >>>> Marco Cosentino >>>>=20 >>>> = --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org >>>> For additional commands, e-mail: log4j-user-help@logging.apache.org >>> = --------------------------------------------------------------------- >>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org >>> For additional commands, e-mail: log4j-user-help@logging.apache.org >>=20 >>=20 >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org >> For additional commands, e-mail: log4j-user-help@logging.apache.org >>=20 >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org > For additional commands, e-mail: log4j-user-help@logging.apache.org >=20 --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-user-help@logging.apache.org