Return-Path: Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: (qmail 30814 invoked from network); 10 Aug 2006 11:51:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 Aug 2006 11:51:38 -0000 Received: (qmail 97764 invoked by uid 500); 10 Aug 2006 11:51:27 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 97697 invoked by uid 500); 10 Aug 2006 11:51:27 -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 97647 invoked by uid 99); 10 Aug 2006 11:51:27 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Aug 2006 04:51:27 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of Neeraj.X.Kumar@gs.com designates 12.47.209.188 as permitted sender) Received: from [12.47.209.188] (HELO mxcd02.gs.com) (12.47.209.188) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Aug 2006 04:51:25 -0700 Received: from unknown (HELO insvsod01.inz.gs.com) ([207.17.36.78]) by mxcd02.gs.com with ESMTP; 10 Aug 2006 07:51:04 -0400 Received: from gsmblnp03es.firmwide.corp.gs.com (gsmblnp03es.firmwide.corp.gs.com [154.1.192.101]) by insvsod01.inz.gs.com with ESMTP; Thu, 10 Aug 2006 07:51:04 -0400 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_NextPart_001_01C6BC73.41155508" X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: RE: One question about extending log4j Date: Thu, 10 Aug 2006 12:51:02 +0100 Message-Id: <4734E6D595AC13498E63C5447A38FB470172C658@gsmblnp03es.firmwide.corp.gs.com> In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: One question about extending log4j Thread-Index: Aca8Nd5kgDqdcxA1Q56sUQLPqlO+yQAPN1bw From: "Kumar, Neeraj X \(Credit\)" To: "Log4J Users List" , X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------_=_NextPart_001_01C6BC73.41155508 Content-Type: text/plain; charset="GB2312" Content-Transfer-Encoding: quoted-printable Hi=20 I have extended the Rolling file appender to create separate files per = thread. Attached is the implementation. For this you need to set up the log4j as log4j.appender.GetAccountInfo=3Dcom.gs.eq.pb.commodore.logger.ExtendedRol= lingFileAppender log4j.appender.GetAccountInfo.File=3Dlogs/GetAccountInfo.log log4j.appender.GetAccountInfo.layout=3Dorg.apache.log4j.PatternLayout log4j.appender.GetAccountInfo.layout.ConversionPattern=3D%d{ABSOLUTE} = %5p %C{1}:%L - %m%n log4j.logger.GetAccountInfo.additivity=3Dtrue log4j.appender.GetAccountInfo.MaxFileSize=3D1KB log4j.appender.GetAccountInfo.MaxBackupIndex=3D3 log4j.logger.GetAccountInfo=3Ddebug, GetAccountInfo Regards Neeraj -----Original Message----- From: Javier Gonzalez [mailto:jagonzal@gmail.com]=20 Sent: Thursday, August 10, 2006 5:31 AM To: Log4J Users List Subject: Re: One question about extending log4j On 8/9/06, =C2=C0=CF=FE=D2=BB wrote: > Hi all, > > I encountered a problem in my requirement. > > Several threads will write different type Value Object to an Object = Queue, > and one Log thread will consume these VO in the Queue, and the Log = thread is > extended from log4J, it will write the VO's value to different log = files > according to the VO's type. > > So, what should I do? Could anybody give me a solution? For each VO, log to a different logger, named after the type of the VO. For example: // receive VO ValueObject vo =3D getFromQueue(); Logger log =3D Logger.getLogger(vo.getType()); log.log(whatever you wish to log); And then, in the log4j configuration file, create an different appender for each VO Type. Attach those appenders to the loggers named after the VO Types. --=20 Javier Gonz=A8=A2lez Nicolini ------_=_NextPart_001_01C6BC73.41155508 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-user-help@logging.apache.org ------_=_NextPart_001_01C6BC73.41155508--