0

I start to use the log4net for my log file, then I want to save the file log base in the date, and I made a couple of research then my configuration looks like this, it's working properly but one problem remaining if not creating new file when the date change, did I miss something in my configuration?

Here is my configuration.

<appender name="AppLogFileAppender" type="log4net.Appender.RollingFileAppender">
  <file type="log4net.Util.PatternString" value="C:/ProgramData/AppTitle/Logs/Application/%date{yyyy-MM}/%date{dd}-log.txt"/>
  <appendToFile value="true"/>
  <rollingStyle value="Date"/>
  <maximumFileSize value="5MB"/>
  <maxSizeRollBackups value="20"/>
  <datePattern value="yyyy-MM-dd"/>
  <layout type="log4net.Layout.PatternLayout">
    <param name="ConversionPattern" value="[%d %-5p] : %m%n%n" />
  </layout>
</appender>
pfx
  • 20,323
  • 43
  • 37
  • 57

1 Answers1

0

You can refer to the following link: Log4net rolling daily filename with date in the file name

There are numerous items which I can see is quite different. For Example you can try adding the below items and see if it works for you. Cheers