1

I use the next configuration for creating a new log file after the current reached 500KB.

<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
      <lockingModel type="log4net.Appender.FileAppender+MinimalLock"/>
      <file type="log4net.Util.PatternString" value="Logs\%date{yyyy-MM-dd_hh-mm-ss}.log" />
      <appendToFile value="true" />
      <rollingStyle value="Size" />
      <maxSizeRollBackups value="10" />
      <maximumFileSize value="500KB" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date – %message%newline" />
      </layout>
</appender>

But I want the log filename will be changed like:

  • Logs\2016-03-27_14-11-02.log
  • Logs\2016-03-27_14-10-50.log
  • Logs\2016-03-27_14-08-32.log
  • Logs\2016-03-27_14-07-30.log

Instead of:

  • Logs\2016-03-27_14-07-30.log
  • Logs\2016-03-27_14-07-30.log.1
  • Logs\2016-03-27_14-07-30.log.2
  • Logs\2016-03-27_14-07-30.log.3

How can I configure it?

Roi Bar
  • 105
  • 11
  • 1
    I don't think it's possible from looking at [how to configure static log file name with compositely named roll backups](http://stackoverflow.com/questions/18063073/how-to-configure-static-log-file-name-with-compositely-named-roll-backups) – stuartd Mar 28 '16 at 12:44
  • do you just want the `.x` gone? – Jacobr365 Mar 30 '16 at 13:50
  • 1
    @Jacobr365 No, as you can see I want a new filename each time, its name should be the creation timestamp. (look at the example I wrote), thanks – Roi Bar Mar 30 '16 at 15:37

0 Answers0