Using Log4Net to use both event log and a rolling log file
Oct 29, 2013
Here’s the config section, note that the applicationNameproperty in the EventLogAppender needs to be the same as the event source in the windows event log that you want to log to. If the event source doesn’t exist, that appender won’t work. In this particular project I create that during install using WiX (which is covered in another post)
<log4netdebug="true">
<appendername="RollingLogFileAppender"type="log4net.Appender.RollingFileAppender">
<filevalue="log.txt"/>
<datePatternvalue="dd-MM-yyyy"/>
<appendToFilevalue="true"/>
<locationinfovalue="false"/>
<rollingStylevalue="Size"/>
<maximumFileSizevalue="1MB"/>
<maxSizeRollBackupsvalue="10"/>
<staticLogFileNamevalue="true"/>
<layouttype="log4net.Layout.PatternLayout">
...
➦
A wonderful day
Oct 03, 2013
Momentous things done today:
Start my first web-based source control https://bitbucket.org/mwanchapStart a blog of some sort (hint: it’s this one!)Drink a beer
Pretty good, I reckon.