logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeusdi <cabre...@terra.es>
Subject Log4Net used into Class library
Date Tue, 05 Feb 2008 12:20:41 GMT

I'm develping a little library, and I'm adding log features to it, now. The
problem is that I don't know How I Can configure Log4Net. In my code I
obtain a logger as:

private log4net.ILog logger =
log4net.LogManager.GetLogger(typeof(OnCloseSessionManager))

but, when I need to use it (the logger), it is null.

I also have this line in my code:
[assembly: log4net.Config.XmlConfigurator(ConfigFile="log4net.xml",
Watch=true)]
but, the logger is null, yet. The beliee that this line find around the
application directory files as log4net.xml and configure the logs using this
xml file...

The log4net.xml file of my application (application that uses my class
library) is:

<?xml version="1.0" encoding="utf-8" ?>
<log4net>
     <appender name="exceptions" type="log4net.Appender.FileAppender">
         <file value="./exceptions.log" />
         <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
         <appendToFile value="true" />
         <layout type="log4net.Layout.PatternLayout">
             <conversionPattern value="%date %level %thread %logger -
%message%newline" />
         </layout>
     </appender>
     <root>
         <level value="ALL" />
         <appender-ref ref="exceptions" />
     </root>
</log4net>

Can you help me please?
I will appreciate a lot your help.
Thanks for all.
-- 
View this message in context: http://www.nabble.com/Log4Net-used-into-Class-library-tp15289024p15289024.html
Sent from the Log4net - Users mailing list archive at Nabble.com.


Mime
View raw message