Thanks Matt. 

Before I try this out myself, which will be in the next couple of hours:
will this return the value of "File" as set in the properties, or will
it return the current file being logged to (i.e. myFile.txt.1)?


-----Original Message-----
From: Matt Hughes [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 27, 2004 2:37 PM
To: Log4J Users List
Subject: Re: getting file path for a logger

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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



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

Reply via email to