Return-Path: Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: (qmail 63121 invoked from network); 7 Dec 2007 00:16:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Dec 2007 00:16:18 -0000 Received: (qmail 57309 invoked by uid 500); 7 Dec 2007 00:16:04 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 57270 invoked by uid 500); 7 Dec 2007 00:16:04 -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 57259 invoked by uid 99); 7 Dec 2007 00:16:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Dec 2007 16:16:04 -0800 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [76.96.62.56] (HELO QMTA06.westchester.pa.mail.comcast.net) (76.96.62.56) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Dec 2007 00:15:41 +0000 Received: from OMTA11.westchester.pa.mail.comcast.net ([76.96.62.36]) by QMTA06.westchester.pa.mail.comcast.net with comcast id Maik1Y00N0mv7h00508d00; Fri, 07 Dec 2007 00:15:43 +0000 Received: from [IPv6:::ffff:192.168.10.103] ([98.196.110.219]) by OMTA11.westchester.pa.mail.comcast.net with comcast id McFa1Y00B4k3qRe0300000; Fri, 07 Dec 2007 00:15:43 +0000 X-Authority-Analysis: v=1.0 c=1 a=oZOmq44l7F4A:10 a=TSbVqHtbAAAA:8 a=oSkkjlEBsoAFLx7RgWMA:9 a=y_FKxVQxNDu9bGedtGAA:7 a=jSRhTXDZFsaSpdvEbf4KPkBv-4sA:4 a=WuK_CZDBSqoA:10 Message-Id: <3208275C-25F0-476C-B2F9-C544B8B6BEE3@apache.org> From: Curt Arnold To: "Log4J Users List" In-Reply-To: <14203484.post@talk.nabble.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v915) Subject: Re: Logging custom level using log4j in java Date: Thu, 6 Dec 2007 18:15:35 -0600 References: <857536730512290906g26e7efd2pa07adedfa59a968d@mail.gmail.com> <14203484.post@talk.nabble.com> X-Mailer: Apple Mail (2.915) X-Virus-Checked: Checked by ClamAV on apache.org On Dec 6, 2007, at 5:19 PM, chiran wrote: > > Hi all, > It is very easy to create a custom log4j level. > All u need is the basic understanding of how the different levels are > organized. > Good example of extending levels for the right reason. > > > Praveen Kumar Hasthalapuram wrote: >> >> Hi All, >> I need to log specified particular type of messages to one log file >> and >> rest >> to another log file. >> >> For example say, if message contains "SNMP" or "CDP" and so on, >> need to >> log in to log1.log >> and rest of the messages need to log in to log2.log >> >> How to configure the log4j.properties to log custom levels? >> >> Is there any provision to create custom levels and to configure it? >> >> I heard that by Filters we can do this, It will be great if anyone >> throw >> some light on this. >> >> Thanks In Advacne, >> >> Praveen >> >> Logger names are the best tool to separate log messages based on target audience or topics. Levels are not intended for that purpose. Many people assume since most examples use class names as logger names, that that is the only pattern that is allowed and try to overload LEVEL to indicate topic or audience. In your case, use a logger named "snmp.whatever" or "cdp.whatever" for messages that you may want to route to different locations. This has been discussed many times previously, see http://permalink.gmane.org/gmane.comp.jakarta.log4j.user/15285 or search for "log4j-user custom level audience" . --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-user-help@logging.apache.org