logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ashish Kulkarni <ashish.kulkarn...@gmail.com>
Subject Find log file name and appender in Java Program
Date Fri, 30 Jan 2009 22:09:40 GMT
HiI need to find out the log file name, and path in Java program,
I tried
logger.getAppender("A1").getName()

and also

Enumeration enu = Logger.getRootLogger().getAllAppenders();

I need to retrieve /app/logs/mylog/log4jXml.xml in my java program

But is it not returning the appender,

my log4j.xml file is as below

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="A1"
class="org.apache.log4j.DailyRollingFileAppender">

<param name="File" value="/app/logs/mylog/log4jXml.xml" />
<param name="DatePattern" value="'.'yyyy-MM-dd" />

<layout class="org.apache.log4j.xml.XMLLayout">

</layout>
</appender>

<category name="myclass">
<priority value="debug" />

<appender-ref ref="A1" />
</category>

<root>
<priority value="INFO" />

<appender-ref ref="STDOUT" />
</root>


</log4j:configuration>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message