Serilog RollingFile

前端 未结 7 1311
囚心锁ツ
囚心锁ツ 2021-01-07 19:45

I am trying to use WriteTo.RollingFile with Serilog as the following:

var log = new LoggerConfiguration().WriteTo.RollingFile(
                    @\"F:\\log         


        
7条回答
  •  花落未央
    2021-01-07 19:48

    Try below:

     var log = new LoggerConfiguration()
              .MinimumLevel.Debug()
              .WriteTo.File(@"f:\log\log.txt", rollingInterval: RollingInterval.Day) 
              .CreateLogger();
    

    The log file name will be automatically log-20150819.txt etc. You do not need to specify the date.Old files will be cleaned up as per retainedFileCountLimit - default is 31.

提交回复
热议问题