I have the following log4net configuration:
<log4net>
<appender name="A1" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="C:\path1.log" />
</appender>
<appender name="A2" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="C:\path2.log" />
</appender>
<logger name="A1Logger">
<level value="ALL" />
<appender-ref ref="A1" />
</logger>
<logger name="A2Logger">
<level value="ALL" />
<appender-ref ref="A2" />
</logger>
</log4net>
and then in code I do the following:
var logger1 = LogManager.GetLogger("A1Logger");
var logger2 = LogManager.GetLogger("A2Logger");
but both log to the same file C:\path1.log
.
What am I doing wrong?
Logger. Additivity Property. Gets or sets a value indicating if child loggers inherit their parent's appenders.
The log4net. config file is located in the \Enterprise7\bin\ directory and is the configuration file for the log4net logging application.
Add the debug="true"
attribute to the <log4net>
element, my guess is that it is the missing <root>
element that causes problems. You should always include the <root />
logger element.
Seems that it was a weird debugging error. Right now it doesn't reproduce. My apologies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With