log4net question



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.


.



Relevant Pages

  • Re: Question about design, defmacro, macrolet, and &environment
    ... "Expects to find the literal string on the stream." ... (defun send (string &optional stream) ... (declaim (inline make-adjustable-string)) ...
    (comp.lang.lisp)
  • Re: Strange problem when not in debugger
    ... private string huidigWeb; ... int buffLength = 2048; ... // Opens a file stream to read the file to be uploaded ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: ReplacerStream
    ... string, do a replace on that string and create a stream again to be ... If those are problems, and you are looking just for a single string, it seems to me that you could just read the stream one character at a time, checking to see if it matches the current character in your search string. ...
    (microsoft.public.dotnet.framework)
  • Re: Strange problem when not in debugger
    ... private string huidigWeb; ... int buffLength = 2048; ... // Opens a file stream to read the file to be uploaded ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: HTTP Object and Retrieving HTML Programatically
    ... I had to hardcode some query string and form post values, ... chunks defined by the buffer size ... //create a stream reader grabbing text we get over HTTP ... while (workingbuffersize> 0) ...
    (microsoft.public.dotnet.framework.aspnet)