getAllAppenders returns empty Enumeration
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   jaikiran_pai
Posted On:   Monday, February 13, 2006 03:00 AM

Hi, We have a appender setup in the log4j.xml as follows: --> We have used this appender for the package "com.dbdata.core" as follows: In our code we use the logger as follows: package com.dbdata.core; public class Test { private Logger logger = Logger.getLogger(this.getClass().getName()); public Test() { logger.info("In constructor"); } } The logging works fi   More>>

Hi,


We have a appender setup in the log4j.xml as follows:



			


















We have used this appender for the package "com.dbdata.core" as follows:



			












In our code we use the logger as follows:



			

package com.dbdata.core;

public class Test {

private Logger logger = Logger.getLogger(this.getClass().getName());

public Test() {

logger.info("In constructor");

}

}




The logging works fine. The logs are written to the correct files. But issue that we are seeing is that the method getAllAppenders() on the Logger returns an empty Enumeration in this class.
We tried a few things one of them being instantiation of the logger. We changed it to:


			
private Logger logger = Logger.getLogger("com.dbdata.core");




Then when we invoked the getAllAppenders() method on the logger we got a Enumeration containing the reference to our appender.

My question is, how can i get references to the appender by instantiating the logger as follows:


			

private Logger logger = Logger.getLogger(this.getClass().getName());




I believe the getAllAppenders() should return the reference to the appender, even in this case, since the logger is using the CORE_LOG appender(verified by checking the logs in the core.log file).

   <<Less
About | Sitemap | Contact