logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hollywood" <hollyw...@thzero.com>
Subject Issue with Repositories and configuration...
Date Fri, 14 Apr 2006 00:20:42 GMT
I have an assembly that I want to use respositories for.  It has the
following declared in the AssemblyInfo.cs file:

// We want this assembly to have a seperate logging repository to the
// rest of the application. We will configure this repository seperatly.
[assembly: log4net.Config.Repository("My.Network")]

// Configure logging for this assembly using the
'My.Network.dll.log4net.config' file
[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension =
"log4net.config", Watch = true)]

There is a class in this assembly that is defined as such:

public class NetLog
{
        private static readonly My.Network.ILogEx log =
My.Network.LogExManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

}

And yes, I have a custom ILog, LogImpl and LogManager; and no they are not
going away.  The custom LogManager, LogExManager, is a duplicate of
LogManager except all instances of ILog are replaced by ILogEx.  LogExImpl
inherits from LogImpl and does ILogEx from ILog.

The issue is, if you put a break point at the 'private static readonly
My.Network.ILogEx log' line, turn on the log4net.Internal.Debugging in the
app's config file, then run it you will see that the static line gets hit
first before the secondary repository is configured.  This means that the
"log" field is using the default repository, which was checked by putting
break points in the various logging methods and checking the logger's
respository.

So whats up?  What am I missing?

No offense, but I'd appreciate only answers from Niko or Ron, unless you
have lots of experience with repositories in log4NET.

Thanks!


Mime
View raw message