May be you can try with 

LogManager.getLoggerRepository().getCurrentLoggers()
in your code ..

and let us know whether it works for u.

Regards,
Krish

--- Burton Strauss <[EMAIL PROTECTED]>
wrote:

> My original test used getAllAppenders() to try and
> find this, but it
> returned NullEnumeration.
> 
>     Logger logger = null;
>     logger = logger.getLogger("test");
>     logger.info("Beginning logger walk");
>     
>     int countOfLoggers = 0;
>     Enumeration loggers =
> org.apache.log4j.LogManager.getCurrentLoggers();
>     if(loggers != null){
>       while(loggers.hasMoreElements()){
>         Logger l = (Logger)loggers.nextElement();
>         logger.info(l.getName()+"
> number:"+(++countOfLoggers));
>         int countOfAppenders = 0;
>         Enumeration allAppenders =
> l.getAllAppenders();
>         System.out.println(allAppenders.getClass());
>         if(allAppenders !=null){
>           while(allAppenders.hasMoreElements()){
>             Appender a =
> (Appender)allAppenders.nextElement();
>             if(a instanceof FileAppender){
>               logger.info("FileAppender");
>             }
>             countOfAppenders++;
>           }
>         }
>       }
>     }
> 
> Gives:
> 
> run-single:
> class org.apache.log4j.helpers.NullEnumeration
> 
> 
> With log4j.properties:
> 
> log4j.rootLogger=debug,test
>
log4j.appender.test=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.test.Append=false
> log4j.appender.test.File=testbed.log
>
log4j.appender.test.layout=org.apache.log4j.SimpleLayout
> 
> 
> 
> -----Burton
> 
> 
> -----Original Message-----
> From: Bender Heri [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, December 01, 2005 3:14 AM
> To: Log4J Users List
> Subject: RE: Silly ? - How do I figure out the name
> of the file the log is
> being written to?
> 
> (FileAppender) Logger.getLogger( <aLoggerName>
> ).getAppender(
> <aAppenderName> ).getFile();
> 
> > -----Original Message-----
> > From: Burton Strauss
> [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, December 01, 2005 5:10 AM
> > To: [email protected]
> > Subject: Silly ? - How do I figure out the name of
> the file the log is 
> > being written to?
> > 
> > 
> > (For want of a better explanation, I want to use
> > system.out.println() to
> > tell the user where to look for the log file)
> > 
> > The log4j logging works great, but I can't figure
> out how to grab the 
> > file name so I can output it...
> > 
> > 
> > Thanks!
> > 
> > -----Burton
> > 
> > 
> >
>
---------------------------------------------------------------------
> > 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]
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 



        
                
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to