Return-Path: Delivered-To: apmail-logging-log4net-user-archive@www.apache.org Received: (qmail 16977 invoked from network); 19 Sep 2005 15:08:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Sep 2005 15:08:28 -0000 Received: (qmail 55122 invoked by uid 500); 19 Sep 2005 15:08:27 -0000 Delivered-To: apmail-logging-log4net-user-archive@logging.apache.org Received: (qmail 55096 invoked by uid 500); 19 Sep 2005 15:08:26 -0000 Mailing-List: contact log4net-user-help@logging.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Log4NET User" List-Id: Delivered-To: mailing list log4net-user@logging.apache.org Received: (qmail 55083 invoked by uid 99); 19 Sep 2005 15:08:26 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Sep 2005 08:08:26 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received: from [80.168.17.114] (HELO hermes.neoworks.co.uk) (80.168.17.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Sep 2005 08:08:35 -0700 Received: from kronos.neoworks.co.uk (kronos.neoworks.co.uk [10.0.0.132]) by hermes.neoworks.co.uk (8.13.1/8.13.1) with ESMTP id j8JF4Wp1024931 for ; Mon, 19 Sep 2005 16:04:32 +0100 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: Including datetime stamp in the log messages. X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Date: Mon, 19 Sep 2005 16:10:46 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Including datetime stamp in the log messages. Thread-Index: AcW9LAMg+zgw5jUoTQGQaxao9i/7vQAACd5Q From: "Nicko Cadell" To: "Log4NET User" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N > Thank you! Thank you! Thank you! Thank you!=20 >=20 > It works. But can you tell me why it needs to be done this=20 > way? Just curious=20 http://logging.apache.org/log4net/release/sdk/log4net.Appender.FileAppen der.ActivateOptions.html >=20 > -----Original Message----- > From: Nicko Cadell [mailto:nicko@neoworks.com] > Sent: Monday, September 19, 2005 10:36 AM > To: Log4NET User > Subject: RE: Including datetime stamp in the log messages.=20 >=20 > Try this:=20 >=20 >=20 > log4net.Appender.FileAppender oFileAppender =3D new=20 > log4net.Appender.FileAppender();=20 >=20 > log4net.Layout.PatternLayout oPatternLayout =3D new=20 > log4net.Layout.PatternLayout();=20 >=20 > oPatternLayout.Header =3D "[Begin]\r\n"; > oPatternLayout.Footer =3D "[End]\r\n\r\n";=20 > oPatternLayout.ConversionPattern =3D "%date[%thread] %-5level=20 > %message%newline"; oPatternLayout.ActivateOptions();=20 >=20 > oFileAppender.Layout =3D oPatternLayout;=20 >=20 > oFileAppender.File =3D ....=20 > oFileAppender.ActivateOptions();=20 >=20 > Then configure log4net to use the oFileAppender.=20 >=20 >=20 > Cheers, > Nicko=20 >=20 > > -----Original Message----- > > From: Ramaa Davanagere [mailto:RDAVANAG@mobius.com] > > Sent: 19 September 2005 14:26 > > To: 'Log4NET User'=20 > > Subject: RE: Including datetime stamp in the log messages.=20 > >=20 > > I'm using log4net 1.2.9.0 > >=20 > > =20 > >=20 > > Right now, my Fileappender output looks like this > >=20 > > =20 > >=20 > > Void > > WriteToLog_Info(System.String):busContent.clsSaveContent.Save( > > ): After calling CreateContentCache() > >=20 > > Void > > WriteToLog_Info(System.String):busContent.clsSaveContent.Save( > > ) - Leaving > >=20 > > Void > > WriteToLog_Info(System.String):busContent.clsRetrieveContent.R > > etrieve() - Entering > >=20 > > =20 > >=20 > > But I want it to look more like this...=20 > >=20 > > =20 > >=20 > > 2005-08-30 08:56:27,968[120048]INFO > > busContent.clsSaveContent.Save(): After calling CreateContentCache() > >=20 > > 2005-08-30 08:56:27,968[120049]INFO > > busContent.clsSaveContent.Save(): Leaving > >=20 > > 2005-08-30 08:56:27,968[120050]INFO > > busContent.clsRetrieveContent.Retrieve() - Entering > >=20 > > 2005-08-30 08:57:58,890[129088]ERROR > > busContent.clsRetrieveContent.SetVersionNumber(): Object=20 > variable not=20 > > set > >=20 > > =20 > >=20 > > 120049 should be the thread id.=20 > >=20 > > =20 > >=20 > > clsSaveContent and clsRetrieveContent are 2 classes of busContent=20 > > component. > >=20 > > =20 > >=20 > > I'm more interested in getting the initial part (2005-08-30 > > 08:56:27,968[120048]INFO) of the message.=20 > >=20 > > =20 > >=20 > > =20 > >=20 > > -----Original Message----- > > From: Nicko Cadell [mailto:nicko@neoworks.com] > > Sent: Monday, September 19, 2005 9:04 AM > > To: Log4NET User > > Subject: RE: Including datetime stamp in the log messages.=20 > >=20 > > =20 > >=20 > > Which version of log4net are you using?=20 > >=20 > > =20 > >=20 > > What does the output of your FileAppender look like at the moment?=20 > >=20 > > =20 > >=20 > > In your desired output example you have a chunk in square=20 > > brackets (e.g.=20 > >=20 > > [120048]) between the date and the level name, what do you=20 > want here?=20 > >=20 > > Thread ID?=20 > >=20 > > =20 > >=20 > > From your example is "Void WriteToLog_Info(System.String)"=20 > > part of your=20 > >=20 > > log message text?=20 > >=20 > > =20 > >=20 > > =20 > >=20 > > Cheers,=20 > >=20 > > Nicko=20 > >=20 > > =20 > >=20 > > > -----Original Message-----=20 > >=20 > > > From: Ramaa Davanagere [mailto:RDAVANAG@mobius.com]=20 > >=20 > > > Sent: 19 September 2005 13:56=20 > >=20 > > > To: 'log4net-user@logging.apache.org'=20 > >=20 > > > Subject: Including datetime stamp in the log messages.=20 > >=20 > > >=20 > >=20 > > > =20 > >=20 > > >=20 > >=20 > > > I'm using a fileappender and logging messages to a text file.=20 > >=20 > > >=20 > >=20 > > > =20 > >=20 > > >=20 > >=20 > > > My Fileappender and PatternLayout are set like this...=20 > >=20 > > >=20 > >=20 > > > =20 > >=20 > > >=20 > >=20 > > > log4net.Appender.FileAppender oFileAppender =3D new=20 > >=20 > > > log4net.Appender.FileAppender();=20 > >=20 > > >=20 > >=20 > > > log4net.Layout.PatternLayout oPatternLayout =3D new=20 > >=20 > > > log4net.Layout.PatternLayout();=20 > >=20 > > >=20 > >=20 > > > oPatternLayout.Header =3D "[Begin]\r\n";=20 > >=20 > > >=20 > >=20 > > > oPatternLayout.Footer =3D "[End]\r\n\r\n";=20 > >=20 > > >=20 > >=20 > > > oPatternLayout.ConversionPattern =3D "%d %-5p %c %m%n";=20 > >=20 > > >=20 > >=20 > > > =20 > >=20 > > >=20 > >=20 > > > But I want the output to look like the sample shown below. I=20 > >=20 > > > want to include the datetime stamp for each message that is=20 > >=20 > > > logged to the text file followed by the message type=20 > >=20 > > > constants (debug, error, fatal, info, etc) and then my=20 > log message.=20 > >=20 > > >=20 > >=20 > > > =20 > >=20 > > >=20 > >=20 > > > 2005-08-30 08:56:27,968[120048]INFO=20 > >=20 > > > MyCompanyName.MyProductName.ErrorHandler - Void=20 > >=20 > > > WriteToLog_Info(System.String) about to write a log message=20 > >=20 > > >=20 > >=20 > > > 2005-08-30 08:57:58,890[129088]ERROR=20 > >=20 > > > MyCompanyName.MyProductName.ErrorHandler - Void=20 > >=20 > > > WriteToLog_Err(System.String): Object variable not set=20 > >=20 > > >=20 > >=20 > > > =20 > >=20 > > >=20 > >=20 > > > Can somebody look at my conversionPattern string and let me=20 > >=20 > > > know what is wrong?=20 > >=20 > > >=20 > >=20 > > > =20 > >=20 > > >=20 > >=20 > > > Thanks.=20 > >=20 > > >=20 > >=20 > > > =20 > >=20 > > >=20 > >=20 > > >=20 > >=20 > >=20 >=20 >=20