logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicko Cadell" <ni...@neoworks.com>
Subject RE: Including datetime stamp in the log messages.
Date Mon, 19 Sep 2005 13:04:01 GMT
Which version of log4net are you using?

What does the output of your FileAppender look like at the moment?

In your desired output example you have a chunk in square brackets (e.g.
[120048]) between the date and the level name, what do you want here?
Thread ID?

>From your example is "Void WriteToLog_Info(System.String)" part of your
log message text?


Cheers,
Nicko

> -----Original Message-----
> From: Ramaa Davanagere [mailto:RDAVANAG@mobius.com] 
> Sent: 19 September 2005 13:56
> To: 'log4net-user@logging.apache.org'
> Subject: Including datetime stamp in the log messages.
> 
>  
> 
> I'm using a fileappender and logging messages to a text file.
> 
>  
> 
> My Fileappender and PatternLayout are set like this...
> 
>  
> 
> log4net.Appender.FileAppender oFileAppender = new 
> log4net.Appender.FileAppender();
> 
> log4net.Layout.PatternLayout oPatternLayout = new 
> log4net.Layout.PatternLayout();
> 
> oPatternLayout.Header = "[Begin]\r\n";
> 
> oPatternLayout.Footer = "[End]\r\n\r\n";
> 
> oPatternLayout.ConversionPattern = "%d %-5p %c %m%n";
> 
>  
> 
> But I want the output to look like the sample shown below. I 
> want to include the datetime stamp for each message that is 
> logged to the text file followed by the message type 
> constants (debug, error, fatal, info, etc) and then my log message. 
> 
>  
> 
> 2005-08-30 08:56:27,968[120048]INFO  
> MyCompanyName.MyProductName.ErrorHandler - Void 
> WriteToLog_Info(System.String) about to write a log message
> 
> 2005-08-30 08:57:58,890[129088]ERROR 
> MyCompanyName.MyProductName.ErrorHandler - Void 
> WriteToLog_Err(System.String): Object variable not set
> 
>  
> 
> Can somebody look at my conversionPattern string and let me 
> know what is wrong?
> 
>  
> 
> Thanks.
> 
>  
> 
> 

Mime
View raw message