Hi, I'm fairly new to this Log4j.
I have several questions. I am using Tomcat. I have jsps and java files. I planned to use 3 logs. I want to maintain Logs to Track Login Time, Logout Time in one log. Second log tracks Critical Requsts of all users. Third log tracks Exceptions and errors for all users. So, I am using DailyRollingFileAppender for these 3 logs. I am configuring logger by an xml file. Here is Loggin Track xml file. Login.xml ---------------- <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <appender name="DailyLog" class="org.apache.log4j.DailyRollingFileAppender"> <param name="File" value="D:/tomcat4110/logs/smileLogs/LoginTrack.log"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d %-5p %m%n"/> </layout> </appender> <root> <priority value="debug"/> <appender-ref ref="DailyLog"/> </root> </log4j:configuration> --------------- and Request Track xml File ---------- <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <appender name="Request" class="org.apache.log4j.DailyRollingFileAppender"> <param name="File" value="D:/tomcat4110/logs/smileLogs/RequestTrack.log"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d %-5p %m%n"/> </layout> </appender> <root> <priority value="debug"/> <appender-ref ref="Request"/> </root> </log4j:configuration> --------- I create loggers in my java, like To get Login Track logger org.apache.log4j.xml.DOMConfigurator.configure("Login.xml"); Logger loginLog = org.apache.log4j.Logger.getLogger("Login"); and to get Request Logger org.apache.log4j.xml.DOMConfigurator.configure("Request.xml"); Logger requestLog = org.apache.log4j.Logger.getLogger("Request"); -------------- When I use these logs like loginLog.debug("Testing Login Track "); requestLog.debug(" Testing Request Track" ); --- I'm getting two log files namely LoginTrack.log and RequestTrack.log. But, LoginTrack is empty and RequestTrack.log contains, 2003-01-25 17:54:57,486 DEBUG Testing Login Track 2003-01-25 17:54:57,486 DEBUG Testing Request Log which means I am getting the same reference for the two loggers. What mistake I've done? How to get 2 different instances? ------------ I receive the name of Logger as argument in Java, if I have created this log, return existing, else I will create new logger and return. I will maintain loggers mapping looger name -- logger. Please point out any mistakes or wrong apprach in the above approach. Will this approach creates some problems at some later poing of time? --- One more question, Imagine, I have successfully running tomcat with these loggers. After some days, the loggers size may become critical. I observed that, I can not delete a log file with out stopping tomcat.. How to delete old log files? I have more questions too.. but those are more related to Tomcat than Log4j. I will share those later. thanks for your advice.. Madhav