logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curt Arnold <carn...@apache.org>
Subject Re: Find log file name and appender in Java Program
Date Sat, 31 Jan 2009 05:13:38 GMT
Once you have a generic Appender object, which could be any one of a  
number of appender types, many of which do not have file names, you  
should test whether it is an instance of FileAppender and then call  
the getFile() method.

if (logger.getAppender("A1") instanceof FileAppender) {
     String file = ((FileAppender) logger.getAppender("A1")).getFile();
}


On Jan 30, 2009, at 4:09 PM, Ashish Kulkarni wrote:

> HiI need to find out the log file name, and path in Java program,
> I tried
> logger.getAppender("A1").getName()

I would think would return "A1" since that is the name of the appender.


---------------------------------------------------------------------
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