logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pwomack <pwom...@papermule.co.uk>
Subject finding all log files for viewing?
Date Fri, 05 Nov 2004 12:49:59 GMT
We would like (in a GUI) to allow our
users to view any-and-all log files.

Is there a convenient way to locate all
active FileAppenders (and its sub-classes)?

The best I've come up with is to do is something like...

Set allFileAppenders = new HashSet();

LoggerRespository repos = Logger.getRootLogger().getLoggerRepository();
for(Enumeration le = repos.getCurrentLoggers(); le.hasMoreElements();) {
     Logger l = (Logger)le.nextElement();
     for(Enumeration ae = l.getAllAppenders(); ae.hasMoreElements();) {
         Appender a = (Appender)ae.nextElement();
         if(a instanceof FileAppender) {

I can then call getFile() on eaach FileAppender. Job Done.

(with apologies for dumb-ass typos)

Is there a better way?


To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message