logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alasdair Richardson" <alasdair.richard...@jabcap.com>
Subject RE: Need to display date inside the log file for each entry
Date Mon, 07 Sep 2009 08:17:53 GMT
I use %date{ISO8601} which gives almost wht you want ... there are
probably other formats


	From: Leo Mathew [mailto:leo.m@sonata-software.com] 
	Sent: Monday, September 07, 2009 10:13 AM
	To: log4net-user@logging.apache.org
	Subject: Need to display date inside the log file for each entry

	Hi All, 


	I am using log4Net. In my log file, I need to print date for
each entries in the log file.


	<?xml version="1.0" encoding="utf-8" ?>

	<log4net debug="false">


	            <appender name="RollingLogFileAppender"

	                        <param name="File" value="logs\\ " />

	                        <param name="AppendToFile" value="true"

	                        <param name="StaticLogFileName"
value="False" />

	                        <param name="RollingStyle" value="Date"

	                        <param name="DatePattern"
value="'.'yyyy-MM-dd'.txt'" />



name="ConversionPattern" value="%d [%t] %-5p %c{1} - %m%n" />





	                        <level value="DEBUG" />

ref="RollingLogFileAppender" />





	The Output I get is similar to the below

	[2916] DEBUG DataServerController - Entering Reload()


	I need like the following output

	2009-09-02 00:11:37,350 [2916] DEBUG DataServerController -
Entering Reload()


	I even tried to change to <param name="ConversionPattern"
value="%date [%t] %-5p %c{1} - %m%n" />


	Does anyone know how this can be achieved?






The information contained in this transmission is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged information. If you are
not the intended recipient (or have received this e-mail in error) please notify the sender
immediately and delete this e-mail. Any unauthorised copying, disclosure or distribution of
the material in this e-mail is strictly forbidden.

View raw message