Thanks for your answer.

<log4net>
        <appender name="Console" type="log4net.Appender.ConsoleAppender">
                <layout type="log4net.Layout.PatternLayout">
                        <!-- Pattern to output the caller's file name and
line number -->
                        <conversionPattern value="%5level [%thread]
(%file:%line) - %message %newline" />
                </layout>
        </appender>
        <root>
                <level value="DEBUG"/>
                <appender-ref ref="Console" />
        </root>
</log4net>

So if I understand correctly, I will need to generate "manually" an
XmlDocument for this log4net settings above. There is no way to serialize
the Hierarchy object and get in output this XmlDocument?
If there is no way, is there an exact matching between the property name and
associated node in the config file? That could help me a lot using
Reflection.

Thanks again.

Ciao,
        Richard.

-----Original Message-----
From: Ron Grabowski [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 31, 2005 11:50 AM
To: Log4NET User
Subject: Re: Programmatically update the config file.


The config file is just a standard XML file. Have you tried using an
XmlDocument object to read the file in, make your changes, then write it
back to the file system? If you've configured log4net to place a file system
watch on the file, when you save the file back out to the hard drive log4net
will re-process it and the changes will take affect.


- Ron

--- Richard Louapre <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I need to programmatically update the config file (log4net.config) in 
> order to keep the changes apply to my log system.
> I did not find anything to do that, maybe I have missed something.
> 
> Does anybody have an sample?
> 
> Many Thanks.
> 
> Ciao,
>       Richard.
> 

Reply via email to