I use %date{ISO8601} which gives almost wht you want ... there are
probably other formats
Alasdair
________________________________
From: Leo Mathew [mailto:[email protected]]
Sent: Monday, September 07, 2009 10:13 AM
To: [email protected]
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"
type="log4net.Appender.RollingFileAppender,log4net">
<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'" />
<layout
type="log4net.Layout.PatternLayout,log4net">
<param
name="ConversionPattern" value="%d [%t] %-5p %c{1} - %m%n" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref
ref="RollingLogFileAppender" />
</root>
</log4net>
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?
Regards
Leo
____________________________________
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.