Alex Rivera | Logout

Log4net rolling daily filename with date in the file name

Asked 2009-07-22T12:57:45.143
136

I would like to have files named for example:

dd.mm.yyyy.log

How is this possible with log4net?

Edit
Report

2 Answers

113

In your Log4net config file, use the following parameter with the RollingFileAppender:

<param name="DatePattern" value="dd.MM.yyyy'.log'" />
answered 2009-07-22T13:02:59.593
33

For a RollingLogFileAppender you also need these elements and values:

<rollingStyle value="Date" />
<staticLogFileName value="false" />
answered 2010-01-15T23:47:24.527

Your Answer