log4net one file per run

I assume that the application should create only one log file every time it runs, so you do not need a rolling file appender (though my solution would apply for rolling file appenders as well): <appender name=”FileAppender” type=”log4net.Appender.FileAppender”> <file type=”log4net.Util.PatternString” value=”c:\temp\App-%date{yyyy-MM-dd_HH-mm-ss}.log” /> <appendToFile value=”true” /> <layout type=”log4net.Layout.PatternLayout”> <conversionPattern value=”%date [%2thread] %-5level – %message%newline” /> </layout> … Read more

Configure Log4net to write to multiple files

These answers were helpful, but I wanted to share my answer with both the app.config part and the c# code part, so there is less guessing for the next person. <log4net> <appender name=”SomeName” type=”log4net.Appender.RollingFileAppender”> <file value=”c:/Console.txt” /> <appendToFile value=”true” /> <rollingStyle value=”Composite” /> <datePattern value=”yyyyMMdd” /> <maxSizeRollBackups value=”10″ /> <maximumFileSize value=”1MB” /> </appender> <appender name=”Summary” … Read more

log4net vs. Nlog

I was recently tasked to “prototype up some loggin’” for an upcoming project. I didn’t have any logging framework experience. I researched, ran through tutorials, made toy apps, etc. on Log4Net, NLog, and Enterprise Library for a few days. Came back 3-4 weeks later and put them together into a cohesive demo. Hopefully some of … Read more