Thanks alot.  This is just what I needed.  Works like a champ.

corey





Ron Grabowski wrote:
> 
> A logger is created from and writes to logger repository
> (ILoggerRepository). By default there is usually one logging repository
> per application. Since the 3rd party library has "corrupted" the default
> repository you can create your own repository and create loggers from
> there. The repository must have a name. The log4net test cases normally
> use a guid for their name:
> 
>  ILoggerRepository rep =
> LogManager.CreateRepository(Guid.NewGuid().ToString());
> 
> You need to tell the XmlConfigurator that you want to configure your
> specific repository instead of the default repository:
> 
>  XmlConfigurator.Configure(rep, new FileInfo("log4net.config"));
> 
> When you request a logger you must now pass the name of the repository
> that you want to create it from:
> 
>  ILog log = LogManager.GetLogger(rep.Name, typeof(Program));
> 
> You could probably write your own helper method somewhere in your
> application so that your logger creation code looks like this:
> 
>  ILog log = GetLogger(typeof(Program));
> 
> Here's a design that a 3rd party library could use to mimic the familiar
> design of log4net without actually referencing a particular version of
> log4net and/or without using log4net at all (i.e. someone could write a
> ConsoleLoggerFactory):
> 
>  public static class LogManager
>  {
>   public static ILog GetLogger( Type type )
>   {
>    return Adapter.GetLogger( type );
>   }
>  
>   public static ILog GetLogger( string name )
>   {
>    return Adapter.GetLogger(name);
>   }
> 
>   public static ILoggerFactoryAdapter Adapter = new NullLoggerFactory();
>  }
> 
>  public interface ILoggerFactoryAdapter 
>  {
>   ILog GetLogger(Type type);
>   ILog GetLogger(string name);    
>  }
> 
>  public interface ILog
>  {
>   void Debug(object message);
>   void Debug(object message, Exception exception);
>   bool IsDebugEnabled { get; }
>   // snip
>  }
> 
> ----- Original Message ----
> From: nagooc <[EMAIL PROTECTED]>
> To: [email protected]
> Sent: Wednesday, June 4, 2008 9:54:00 AM
> Subject: Multiple Loggers Stepping on Toes
> 
> 
> I'm working with a 3rd party component that is using Log4net.  Their
> logger
> is configured programatically.
> 
> My homegrown components use Log4Net as well and are configured using a
> seperate XML file.  As soon as I access a certain line of code in the 3rd
> party component, my logger gets its Debug and Info logging disabled.
> 
> I'm confused how this is happening.  I'm getting a log by totally
> different
> name.  Anyone ever see this or know how to fix it?
> -- 
> View this message in context:
> http://www.nabble.com/Multiple-Loggers-Stepping-on-Toes-tp17647324p17647324.html
> Sent from the Log4net - Users mailing list archive at Nabble.com.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Multiple-Loggers-Stepping-on-Toes-tp17647324p17673633.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

Reply via email to