logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Radovan Raszka" <ras...@hasam.cz>
Subject RE: Log4Net used into Class library
Date Tue, 05 Feb 2008 13:09:08 GMT
You must configure logging system first:

// after configuring you can get logger instance
logger = log4net.LogManager.GetLogger(typeof(OnCloseSessionManager))

If you can not configure log4net using XmlConfiguratorAtttribute, check
if config file is on the expected path (in the same directory as your

-----Original Message-----
From: jeusdi [mailto:cabrejcr@terra.es] 
Sent: Tuesday, February 05, 2008 1:21 PM
To: log4net-user@logging.apache.org
Subject: Log4Net used into Class library

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 =

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",
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" ?>
     <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" />
         <level value="ALL" />
         <appender-ref ref="exceptions" />

Can you help me please?
I will appreciate a lot your help.
Thanks for all.
View this message in context:
Sent from the Log4net - Users mailing list archive at Nabble.com.

View raw message