logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Hughes <mhug...@feith.com>
Subject Re: getting file path for a logger
Date Wed, 27 Oct 2004 18:36:55 GMT
Marc Esher (4-2060) wrote:

>Hi All,
>
>  Is there a way to have log4J return to me a string containing the file
>path for a specific logger?
>
> 
>
>Thanks.
>
>
>  
>
It goes something like this.

Logger logger = LogManager.getLogger(Some.class);
Enumeration e = logger.getAllAppenders();
while (e.hasMoreElements()) {
    Appender a = (Appender)e.nextElement();
    if (a instanceof FileAppender) {
      FileAppender fa = (FileAppender)fa;
       //This
        String fileName = fa.getFile();
    }
}
}

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


Mime
View raw message