see comment inline > -----Original Message----- > From: Balaji Saranathan [mailto:[EMAIL PROTECTED] > Sent: Wednesday, July 06, 2005 5:21 PM > To: 'Log4J Users List'; [EMAIL PROTECTED]; 'Bradley, Todd' > Subject: RE: Log4J Help requested > > > > I was using the getAllAppenders on the logger that was created with > classname. It returns an empty enumeration. The Root > logger.getAllAppenders lists my appender I added in the configuration. > Is it not true that the appenders are inherited from the rootlogger > unless explictiyl configured?
Not exactly. Log4j creates a hierarchy of named loggers, similar to the package hierarchy, using the dot as node separator. If your logger which you have instantiated by using the classname is not configured exactly with the same classname, the log4j will create a new logger without any appenders, but with the flag inherited=true, and place this logger somewhere in the hierarchy below root looger. If you make a log statement against this logger, it will serve all appenders defined within itself (in this case none) and also all appenders attached to loggers higher in the hierarchy, until it reaches the root logger or a logger with inerited=false. So, if you want to access the configured appenders by code you have to create a logger using exactly the same name like in config file. In your case it's the root logger which you get by calling Logger.getRootLogger(). Clear? Heri --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]