I'm working on getting logging up on struts with Log4J right now as well. I'm also new to struts. I am using the following log4j.xml file (in my WEB-INF/classes) directory and getting a log file successfully.

My 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="appender" class="org.apache.log4j.DailyRollingFileAppender">
   <param name="File" value="logs/my_log_file.log"/>
   <param name="Append" value="true"/>
   <param name="DatePattern" value="'.'yyyy-MM-dd" />
   <layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p - %d{MM/dd/yyyy HH:mm:ss.SSS} - [%t] - %m%n"/>
   </layout>
 </appender>

 <root>
   <priority value ="debug"/>
   <appender-ref ref="appender"/>
 </root>

</log4j:configuration>

The "File" param contains a relative path to the log file. My tomcat server seems to want to put $TOMCAT_HOME in front of that. I'm seeing my log file appear in the standard tomcat logs directory using the above XML. I'm using Tomcat 5.5 on windows and log4j 1.2.13 by the way. One question I wanted to throw out here was how to strip all the tomcat rubbish from the log file and have it only log messages I write from my application. I'm getting things like:

DEBUG - 06/14/2006 14:24:45.823 - [ContainerBackgroundProcessor[StandardEngine[Catalina]]] - Start expire sessions StandardManager at 1150309485823 sessioncount 1 DEBUG - 06/14/2006 14:24:45.823 - [ContainerBackgroundProcessor[StandardEngine[Catalina]]] - End expire sessions StandardManager processingTime 0 expired sessions: 0

and

DEBUG - 06/14/2006 14:23:45.697 - [Thread-1] - [SetNextRule]{form-validation/formset} Call org.apache.commons.validator.ValidatorResources.addFormSet(FormSet: language=null country=null variant=null
  Form: LogonForm
   Field:
       key = userid
       property = userid
       indexedProperty = null
       indexedListProperty = null
       depends = required
       page = 0
       fieldOrder = 0
       Vars:

I'm lots of other things that I did not put into the log file myself (141,300 lines when I empty the log file and just turn on tomcat... some of which are whitespace). I guess I'm looking for a way to turn off struts and tomcat logging. Anyone have any thoughts?

Cheers,
R





Darren Hall wrote:
I tried that. There is no output from log4j to the daily catalina.log files.

However, taking another path, I created a new (and much simpler) log4j.xml
file. Using this new file, I now see the following log file created
'C:\Program Files\Apache Group\Tomcat 5.5\logs\uwaf-debug.log'.
So... progress!

However, the log file contains nothing. None of my info or debug statements
were printed to the file. It's blank. What did I do wrong now?
Any ideas??

Thanks,

Darren

(log4j.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="DEBUG" class="org.apache.log4j.FileAppender">
    <param name="File" value="logs/uwaf-debug.log" />
    <param name="Threshold" value="DEBUG" />
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d{ISO8601} %-5p %c - %m%n"/>
    </layout>
  </appender>

  <logger name="com.uwaf">
    <level value="debug"/>
    <appender-ref ref="DEBUG"/>
  </logger>

</log4j:configuration>




-----Original Message-----
From: Dave Newton [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 14, 2006 11:19 AM
To: Struts Users Mailing List
Subject: Re: [newb question] Turning on DEBUG level logging

Darren Hall wrote:
I'm not starting it from the command line any longer. Therefore, I can't
see
any console output from Tomcat.

Try using a ConsoleAppender and tail -f the log file in the tomcat log
directory.

Dave



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