Can Log4net have multiple appenders write to the same file?
Posted
by adam0101
on Stack Overflow
See other posts from Stack Overflow
or by adam0101
Published on 2010-06-09T22:18:02Z
Indexed on
2010/06/09
22:22 UTC
Read the original article
Hit count: 335
I'm using a RollingFileAppender to log some info to a file with a conversionPattern (in the web.config) that looks like this for the header of each log section:
<conversionPattern value="%date - %property{userId} - %property{method}%newline--------------------------------%newline%message%newline%newline"/>
I'd like to log details under this header as bullet points. I'm currently trying to use another RollingFileAppender that logs to the same file with a simple conversionPattern of just a dash, like this:
<conversionPattern value="- %message%newline"/>
But these messages aren't making it into the log file. I'm using Log.Info() for the header and Log.Debug() for the bullet points and filtering each appender on their respective log levels. Is what I'm trying to do possible? Or is there a better way to get header and detail information into a log file from log4net?
© Stack Overflow or respective owner