log4net one file per run -


Every time I run it, I need my application to create a log file.

My preferred format will be App.log.yyyy -mM-dd_HH-MM-SS . If this is not possible, then I want to decide for App.log.yyyy-MM-dd.counter

This is my current appender configuration:

But it creates several random files based on date and time.

I think every time the application should be created, only one log file should be created, The adender is not required (though my solution will also apply to rolling file appenders):

  & lt; Appender Name = "File Affair" type = "log4net.Appender.FileAppender" & gt; & Lt; File type = "log4net.Util.PatternString" value = "c: \ temp \ application-% dated {yyyy-MM-dd_HH-mm-ss} .log" /> & Lt; AppendToFile value = "true" /> & Lt; Layout type = "log4net.Layout.PatternLayout" & gt; & Lt; Conversion value value = "% date [% 2 thread]% -5 level -% message% newline" / & gt; & Lt; / Layout & gt; & Lt; / Appender & gt;  

(Obviously you can use your own layouts and other settings for file appenders.)


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -