P
pedrito
I know this isn't the log4net support mailing list, but I was hoping someone
could give me a quick hand with this. I just don't like the idea of
subscribing to a mailing list to ask a single question, have to filter
through all the stuff I don't care about and then unsubscribe after I get
help.
What I'm doing, seems pretty simple, but I can't seem to figure out how to
get it to work. I have the XML data for the configuration as an embedded
resource in my assembly.
It is as follows (just for testing purposes)
<?xml version="1.0" encoding="utf-8" ?>
<appender name="RollingFileAppender"
type="log4net.Appender.RollingFileAppender">
<file value="c:\mylog.log" />
<levelMin value="INFO" />
<levelMax value="FATAL" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger
[%property{NDC}] - %message%newline" />
</layout>
</appender>
To load the configuration, I simply get the stream for the logger and do:
XmlConfigurator.Configure(stream);
I verified that the stream does in fact contain my XML by using a stream
reader and reading the contents into a string and the string looks correct.
I get the ILog as follows:
private static readonly log4net.ILog log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
The problem is, after calling XmlConfigurator.Configure(), my log still has
IsInfoEnabled = false, IsDebugEnabled = false, IsErrorEnabled = false, and
IsFatalEnabled = false.
I tried getting the logger after calling XmlConfigurator.Configure(), but
there was no difference.
Their examples are pretty slim and the documentation a bit hard to follow.
There don't appear to be any examples using XmlConfiguration.Configure(), so
that's probably where my problem is.
Anyone have any ideas?
Thanks.
could give me a quick hand with this. I just don't like the idea of
subscribing to a mailing list to ask a single question, have to filter
through all the stuff I don't care about and then unsubscribe after I get
help.
What I'm doing, seems pretty simple, but I can't seem to figure out how to
get it to work. I have the XML data for the configuration as an embedded
resource in my assembly.
It is as follows (just for testing purposes)
<?xml version="1.0" encoding="utf-8" ?>
<appender name="RollingFileAppender"
type="log4net.Appender.RollingFileAppender">
<file value="c:\mylog.log" />
<levelMin value="INFO" />
<levelMax value="FATAL" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger
[%property{NDC}] - %message%newline" />
</layout>
</appender>
To load the configuration, I simply get the stream for the logger and do:
XmlConfigurator.Configure(stream);
I verified that the stream does in fact contain my XML by using a stream
reader and reading the contents into a string and the string looks correct.
I get the ILog as follows:
private static readonly log4net.ILog log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
The problem is, after calling XmlConfigurator.Configure(), my log still has
IsInfoEnabled = false, IsDebugEnabled = false, IsErrorEnabled = false, and
IsFatalEnabled = false.
I tried getting the logger after calling XmlConfigurator.Configure(), but
there was no difference.
Their examples are pretty slim and the documentation a bit hard to follow.
There don't appear to be any examples using XmlConfiguration.Configure(), so
that's probably where my problem is.
Anyone have any ideas?
Thanks.