Philippe,

Apologies for the documentation, it is still evolving.

There are examples in C# and VB in the log4net download see:
examples\net\1.0\Tutorials\ConsoleApp

To configure the DOMConfigurator to set different levels for different
loggers you would do something like this:

<configuration>
        <configSections>
                <section name="log4net"
type="System.Configuration.IgnoreSectionHandler" />
        </configSections>

        <log4net>
                <appender name="ConsoleAppender"
type="log4net.Appender.ConsoleAppender">
                        <layout type="log4net.Layout.PatternLayout">
                                <conversionPattern value="%d [%t] %-5p %c
[%x] &lt;%X{auth}&gt; - %m%n" />
                        </layout>
                </appender>
                <root>
                        <level value="DEBUG" />
                        <appender-ref ref="ConsoleAppender" />
                </root>
                <logger name="My.Code.That.Works">
                        <level value="INFO" />
                </logger>
        </log4net>
</configuration>

The ConsoleAppender is used for illustrative purposes only.
In this example the <root> is set to level DEBUG. The logger called
"My.Code.That.Works" has its level set to INFO.

You can load this configuration from a file using the
DOMConfigurator.Configure(FileInfo) method, or you can load it from your
application's .config file using the assembly attribute [assembly:
log4net.Config.DOMConfigurator].

Cheers,

Nicko

> -----Original Message-----
> From: Philippe Lavoie [mailto:[EMAIL PROTECTED] 
> Sent: 02 March 2004 16:29
> To: [email protected]
> Subject: Having two levels of logging
> 
> Hi,
>  
> As my code gets better and better. I'd like to put some 
> classes to a "INFO" level, the rest should stay at a debug level.
>  
> What kind of configuration do I need to do to be able to set 
> some namespaces to "info" and the root to "debug"?
>  
> I'm looking into the new site and finding information there 
> is rather difficult :-(  I can't find a tutorial, I can't 
> find a description of the configuration tags, etc. If you 
> know how to get to that information, please let me know.
>  
> Also, that site mentions XmlConfigurator instead of 
> DomConfigurator in the documentation. That didn't work out 
> too well when I tried it :-) Can someone change the referens 
> to XmlConfigurator to DomConfigurator?
>  
> Thanks for any help.
>  
> Philippe Lavoie
>  
>    Cactus Commerce         eBusiness. All Business.
>  Tel 819.778.0313 x302 * 888.CACTUS.0 * Fax 819.771.0921 
> www.cactuscommerce.com [EMAIL PROTECTED]
>  
> 

Reply via email to