Hi Marco, sorry, i did not read Yoav's reply before I submitted mine. for some unexplainable reason Yoav's mail reached my mailbox only after I sent my reply. Since I never use getAllAppenders() before, i looked into the java doc files. According to that getAllAppenders() returns all appender for the Category, for which it is called. It does not say anything about sub categories (or category hierarchie). That is why I suggested a way that makes sure, you get all loggers that are currently available ( LogManager.getCurrentLoggers() ) . If getRootLogger().getAllAppenders() work, I would use that. It is much more simple to use.
György -----Ursprüngliche Nachricht----- Von: Marco Herrn [mailto:[EMAIL PROTECTED] Gesendet: Montag, 8. März 2004 16:44 An: Log4J Users List Betreff: Re: AW: getting an Appender object at runtime Hi Gyoergy, hi Yoav, [EMAIL PROTECTED] wrote: > To make sure, you get all available loggers , I would use > > for( Enumeration enumLoggers = > LogManager.getCurrentLoggers();enumLoggers.hasMoreElements();) { > Logger logCurrent = (Logger) enumLoggers.nextElement() ; > for (Enumeration enumAppenders = > logCurrent.getAllAppenders();enumAppenders.hasMoreElements();) { > .... evaluate your appender > } > } Yes, that seems good. What is the advantage to using Logger.getRootLogger().getAllAppenders() as in the example from Yoav? Wouln't I get all loggers in this case, too? > However I would do it the other way around. Why don't you write your own Managing > class, and when an Appender is instantiated (or bound to a logger) register it with > this class? Then you could ask your own Manager class. That would be too much in my case. I do not need this. It now works very well. Thanks to you both. Marco --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]