Kramer, Mat | 27 Apr 2012 17:12

RE: Duplicate log entries with DLL/EXE combination

Paul,

Thanks for the response.

Each of the assemblies is configured via the following entries in the AssemblyInfo.cs file:

	[assembly: log4net.Config.Repository]
	[assembly: log4net.Config.XmlConfigurator(ConfigFile = "my-assembly-log4net.config")]

I've tried changing the "conversionPattern" to determine which appender definition is being used.  It is
always using the application's appender definition.  All output is going to the output file defined there.

Any class that needs to log will have a static member like this:

	private static readonly ILog DebugLog = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

-Mat

-------
From: Paul Dejardin [mailto:pdejardin <at> factset.com] 
Sent: Friday, April 27, 2012 7:56 AM
To: Log4NET User
Subject: RE: Duplicate log entries with DLL/EXE combination

How are you configuring? (programmatically, custom attribute, etc.) My guess would be that the
'DebugAppender' is being added twice (once in two separate repositories). You could use the same
Repository for both assemblies. How are you creating loggers in code?

-------
From: Kramer, Mat [mailto:MKramer <at> datasci.com] 
(Continue reading)

Paul Dejardin | 27 Apr 2012 17:37
Favicon

RE: Duplicate log entries with DLL/EXE combination

private static readonly ILog DebugLog = LogManager.GetLogger(typeof(<yourclass>));
^--- this is the typical usage

http://logging.apache.org/log4net/release/manual/configuration.html

try removing the RepositoryAttribute from each assembly

http://logging.apache.org/log4net/release/sdk/log4net.Config.RepositoryAttribute.html

if that doesn't work, try programmatically getting all appenders from the default repository root
logger. Shouldn't be duplicates, but I don't really know the internals of that.

Are you getting any output from log4net? (failed to configure or some such message)

-----Original Message-----
From: Kramer, Mat [mailto:MKramer <at> datasci.com] 
Sent: Friday, April 27, 2012 11:12 AM
To: Log4NET User
Subject: RE: Duplicate log entries with DLL/EXE combination

Paul,

Thanks for the response.

Each of the assemblies is configured via the following entries in the AssemblyInfo.cs file:

	[assembly: log4net.Config.Repository]
	[assembly: log4net.Config.XmlConfigurator(ConfigFile = "my-assembly-log4net.config")]

I've tried changing the "conversionPattern" to determine which appender definition is being used.  It is
(Continue reading)


Gmane