I am using Log4Net to log messages in a C# Window console application (.Net 2.0). It works fine. I need to create a new log file daily with Date as part of the log file name. I tried using RollingFileAppender in the config file
<log4net debug="true">
<appender name="RollingLogFileAppend
er" type="log4net.Appender.Rol
lingFileAp
pender">
<param name="File" value="C:\Kiran_Work\MASSA
UTO\tempar
ea\\logfil
e.log.yyyy
MMdd" />
<param name="AppendToFile" value="true" />
<param name="rollingStyle" value="Date" />
<param name="datePattern" value="yyyyMMdd" />
<layout type="log4net.Layout.Patte
rnLayout">
<param name="conversionPattern" value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
<root>
<priority value="DEBUG" />
<appender-ref ref="RollingLogFileAppende
r" />
</root>
</log4net>
It is creating a log file with logfile.log.yyyyMMdd name literally and not substituting the yyyyMMdd with actual date. What am i doing wrong here? Do i need set the date in the application code somehow?
Any help is greatly appreciated.
Start Free Trial