You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Marc Esher (4-2060)" <me...@argusgroupinc.com> on 2004/10/27 18:14:33 UTC
getting file path for a logger
Hi All,
Is there a way to have log4J return to me a string containing the file
path for a specific logger?
Thanks.
Re: getting file path for a logger
Posted by Matt Hughes <mh...@feith.com>.
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
Re: getting file path for a logger
Posted by Ceki Gülcü <ce...@qos.ch>.
At 06:14 PM 10/27/2004, you wrote:
>Hi All,
>
> Is there a way to have log4J return to me a string containing the file
>path for a specific logger?
What do you mean by a the file path for a specific logger? Loggers are not
files. Loggers *may* contain one or more appenders which may be of type
FileAppender. Could you be more specific?
>Thanks.
--
Ceki Gülcü
For log4j documentation consider "The complete log4j manual"
http://www.qos.ch/shop/products/eclm/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org