You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Shaily Goel <gs...@novell.com> on 2005/09/02 11:58:24 UTC

inheritance of appenders from Parent

Hi
 
I am facing a problem in inheritance of appenders from Parent. 
 
version of Log4net used: incubating-log4net-1.2.9-beta ; 
 Platform: Windows 
 
Test: Test if logger a.b inherits its appender from a.
 
static void Main(string[] args)
  {   
       
            Logger a = LogManager.GetLogger("a").Logger as Logger;
            a.Additivity = true;
            a.Repository.Configured = true; 
            
            ConsoleAppender ca = new ConsoleAppender();
            ca.Name = "Test";              
            ca.ActivateOptions();
            
            a.AddAppender(ca);
            Logger ab = LogManager.GetLogger("a.b").Logger as Logger; 

            IAppender ar = ab.GetAppender("Test");
}
 
I found that there is no appender inherited by Logger a.b. Why is it
so?
 
What should I do to make "a.b" inherits all the appender of "a".
 
Thanks
Shaily

 

Re: inheritance of appenders from Parent

Posted by Shaily Goel <gs...@novell.com>.
I need to ask one more thing. 
 
Suppose in below example I want to change the severity level of Console
Appender from "Debug" to "Error". But it should affect only the logger
a.b which means the messages which are logged using a.b should get this
affective setting . This means only messages "Error and above" will be
logged by logger a.b.
 
Whereas if there are any more child of "a". e.g. a.c it should be  able
to log the messages with severity "Debug and above".
 
How can I change the ConsoleAppender settings for logger "a.b" only.
These settings should not affect the other child appenders of "a".
 
Note: I do not want to add the new instance of Console appender for
a.b.
 
Please help me changing the inherited appender settings for logger a.b
only.
 
 
Thanks
Shaily

>>> gshaily@novell.com 09/02/05 3:28 PM >>>

Hi
 
I am facing a problem in inheritance of appenders from Parent. 
 
version of Log4net used: incubating-log4net-1.2.9-beta ; 
Platform: Windows 
 
Test: Test if logger a.b inherits its appender from a.
 
static void Main(string[] args)
  {   
       
            Logger a = LogManager.GetLogger("a").Logger as Logger;
            a.Additivity = true;
            a.Repository.Configured = true; 
            
            ConsoleAppender ca = new ConsoleAppender();
            ca.Name = "Test";              
            ca.ActivateOptions();
            
            a.AddAppender(ca);
            Logger ab = LogManager.GetLogger("a.b").Logger as Logger; 

            IAppender ar = ab.GetAppender("Test");
}
 
I found that there is no appender inherited by Logger a.b. Why is it
so?
 
What should I do to make "a.b" inherits all the appender of "a".
 
Thanks
Shaily