Return-Path: Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: (qmail 79730 invoked from network); 17 Dec 2007 19:52:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Dec 2007 19:52:03 -0000 Received: (qmail 46988 invoked by uid 500); 17 Dec 2007 19:51:49 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 46874 invoked by uid 500); 17 Dec 2007 19:51:49 -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 46836 invoked by uid 99); 17 Dec 2007 19:51:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Dec 2007 11:51:49 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [66.101.73.148] (HELO vmtbosmail01.VMTBOSTON.VAULTUS.COM) (66.101.73.148) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Dec 2007 19:51:38 +0000 Received: from vmtbosmail01.VMTBOSTON.VAULTUS.COM ([10.52.0.31]) by vmtbosmail01.VMTBOSTON.VAULTUS.COM ([10.52.0.31]) with mapi; Mon, 17 Dec 2007 14:50:27 -0500 From: "Mak, Howard" To: Log4J Users List Date: Mon, 17 Dec 2007 14:50:27 -0500 Subject: RE: parent logger to filter child logger by level Thread-Topic: parent logger to filter child logger by level Thread-Index: AchA5I8abPXMazYsQVWibqjrZfAsfAAAIwdQ Message-ID: In-Reply-To: <0E87DFB8-6493-49EF-84BA-77C0364D4F28@apache.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org Thanks for your response. Here is what I'm trying to achieve: (1) File A contains all logs (2) File B contains only the FATAL/ERROR/WARN logs in file A In other words, (2) provides a bird's eye view of problems that can be easi= ly missed when reading in (1) (which can be quite big). Is my only option to write a filter-by-Level appender to be used by (1)? - Howard -----Original Message----- From: Curt Arnold [mailto:carnold@apache.org] Sent: Monday, December 17, 2007 14:40 To: Log4J Users List Subject: Re: parent logger to filter child logger by level On Dec 17, 2007, at 1:05 PM, Mak, Howard wrote: > I'm trying to duplicate WARN logs to a separate file by using the > below log4j.properties. > > log4j.rootLogger =3D WARN, > log4j.logger.MYLOG =3D ALL, > log4j.additivity.MYLOG =3D true > > However, appender_1 contains more stuff than I want. > > Am I wrong to expect that rootlogger will filter out all logs other > thatn MYLOG @ or ? Yes. appender_1 will should receive all logging requests with a level of WARN or higher and any logging requests sent to the "MYLOG" appender regardless of level. There are two independent concepts, one is the effective level threshold of a logger and the other is the destination of any logging events that satisfy the effective level threshold. The effective level of a logger is the level of its nearest ancestor with an explicitly set level and rootLevel is the ultimate ancestor of any logger. So the "MYLOG" logger or any logger that starts "MYLOG." will have an effective level of ALL (the lowest possible level) and any other logger will have an effective level of WARN. If a logging requests meets or exceeds the effective level of its logger, then it is processed by every appender attached to the logger and every ancestor stopping after it reaches the rootLogger or a logger with additivity set to false. The effective level of the intermediary loggers do not affect propagation. The default value for additivity is true, so your configuration line that sets the value to its default, while legal, is atypical. If you wanted logging requests that were sent to "MYLOG" or descendants to not be sent to appender_1, then you should set additivity to false. Specifically, the propagation logic would not check that a logging request that propagated from MYLOG is WARN or higher. The independence of the effective level and propagation allows a user to drop the threshold in a specific part of the logger hierarchy by simply inserting a lower level at the point of concern. It would be very common for the rootLogger to have an INFO level and then some descendant to be set to DEBUG or TRACE to get more detailed info. > Am I confusing level inheritance down to children loggers vs. filter > of children logs by parent loggers? Is the latter not supported by > Log4j? > Could you explain the end result you'd like to achieve? > I'm using version 1.2.15. > > Thanks for any help. > > - Howard > > --------------------------------------------------------------------- > 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 --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-user-help@logging.apache.org