For each project, reference the log4net dll and put the following line
in the assemblyInfo file:
[assembly: log4net.Config.XmlConfigurator(
ConfigFile="log4net.config",Watch=true )]
Now at the class level for each class add the following line to create
an instance of the logger:
private static readonly ILog log = LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
Now you can make calls like so from your methods:
log.Error(ex.Message.ToString(), ex);
Hope that helps
Dave
________________________________
From: Erlis Vidal [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 23, 2007 5:11 PM
To: [email protected]
Subject: Config log4net in n-tiear application Framework 2.0!
Hi everyone!
I want to configure log4net in order to use the same configuration file
(with the watch option active) in my n-tier application!
I have the following structure in my solution:
Website (as a web application project)
Business (as a class library project)
Data (as a class library project)
Test (as a class library project)
I want to be able to log messages in any of those layers using the same
log4net configuration file...
Can you provide any suggestion for the right configuration?
Regards,
Erlis