1

For a .NET application , we need a Logging Framework. The main requirements are

1)Support different kinds of Logging levels - like Debug , Warn etc
2)A new log file should be created , when the current file exceeds a particular size
3)The back up log files should be deleted after a configured amount of time period like for ex: - 1 day

Are there any frameworks that satisy 3rd criteria

Regards
Sabarish

Sabarish Sathasivan
  • 1,196
  • 2
  • 19
  • 42

3 Answers3

0

Log4Net can do pretty much anything with custom appenders. Take a look here: How I can set log4net to log my files into different folders each day? or here: Can Log4Net Delete Log Files Automatically?

Community
  • 1
  • 1
kor_
  • 1,510
  • 1
  • 16
  • 36
0

Serilog provides this; e.g.

var log = new LoggerConfiguration()
    .WriteTo.RollingFile("C:\\Logs\\myapp-{Date}.txt",
        fileSizeLimitBytes: 123456,
        retainedFileCountLimit: 31)
    .CreateLogger(); 

Files are rolled each day, with the size limit being more of a "safety" feature than a rolling strategy, but the results should match pretty closely with what you're looking for.

Nicholas Blumhardt
  • 30,271
  • 4
  • 90
  • 101
0

I wrote somewhat simple but sufficient framework for logging myself being tired of overcomplication of log4net, nlog etc. https://github.com/aloneguid/logmagic

Ivan G.
  • 5,027
  • 2
  • 37
  • 65