logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darren Hall" <dh...@utrs.com>
Subject RE: setting up log4j
Date Tue, 13 Jun 2006 21:07:10 GMT
I've now downloaded Log4J and created a log4j.xml file (modified from a
sample I found online).

I assume commons-logging will find log4j since the documentation says it is
the preferred (default) logging tool choice. My war file deploys correctly,
however I don't see any log output being generated.

What am I doing wrong? Can anyone help?

Thanks

(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="event_file" class="org.apache.log4j.DailyFileAppender">
    <param name="Threshold" value="DEBUG"/>
    <param name="File" value="log/uwaf-event.log"/>
    <param name="Append" value="true"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
    </layout>
  </appender>

  <appender name="error_file" class="org.apache.log4j.DailyFileAppender">
    <param name="Threshold" value="INFO"/>
    <param name="File" value="log/uwaf-error.log"/>
    <param name="Append" value="true"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
    </layout>
  </appender>

  <appender name="console" class="org.apache.log4j.ConsoleAppender"> 
    <param name="Target" value="System.out"/> 
    <param name="Threshold" value="INFO"/>
    <layout class="org.apache.log4j.PatternLayout"> 
      <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}]
%m%n"/>
    </layout> 
  </appender> 

  <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
    <appender-ref ref="event_file"/>
    <appender-ref ref="error_file"/>
  </appender>

  <!-- Setup the Root category -->
  <root>
    <appender-ref ref="ASYNC"/>
  </root>

</log4j:configuration>


-----Original Message-----
From: Darren Hall [mailto:dhall@utrs.com] 
Sent: Tuesday, June 13, 2006 10:58 AM
To: 'Log4J Users List'
Subject: RE: setting up log4j

Thanks Jake,

Maybe I should back up...

Since Struts is using commons-logging, do I need to include any Log4J jar
files? What is commons-logging using under the covers?



-----Original Message-----
From: Jacob Kjome [mailto:hoju@visi.com] 
Sent: Tuesday, June 13, 2006 1:02 AM
To: Log4J Users List
Subject: Re: setting up log4j


Put log4j.jar and commons-logging-adapters-1.1.jar (see 
commons-logging release notes for this newly distributed jar) in 
WEB-INF/lib.  This assumes that commons-logging-api.jar is in the 
classpath.  If this doesn't work, just use the 
commons-logging-1.1.jar.  Put your Log4j config file in 
WEB-INF/classes.  You might want to use log4j.xml, since the XML 
config files are picked up in preference to the properties files and 
if there is a log4j.xml elsewhere on the classpath, Log4j might use 
it instead of the properties file you think it is using.  When in 
doubt, set -Dlog4j.debug=true.

Jake

At 04:02 PM 6/12/2006, you wrote:
 >Greetings all,
 >
 >
 >
 >I'm using Struts 1.2.9 (with commons-logging 1.1) and the problem I'm
having
 >is that I cannot seem to get my DEBUG level log statements to print.
 >
 >>From what I've read online, it seems that commons-logging is a wrapper
 >around log4j (actually I have not confirmed this and tend to doubt it
since
 >I don't see any references to log4j in my installation of struts). In any
 >case, the commons-logging output for struts is printing to the Tomcat
logs.
 >It does not print my DEBUG level messages, and I need to get this to
happen.
 >
 >
 >
 >Since I couldn't find a reference to log4j in my Struts installation, I
 >downloaded log4j and included it in my build of struts, and now I get no
 >messages to print to the Tomcat logs (not INFO or ERROR, which were
printing
 >before I installed log4j). I created a simple "log4j.properties" file to
 >attempt to configure log4j and obviously I failed miserably.
 >
 >
 >
 >Basically I need to know how to either A) get my debug messages printing
to
 >the Tomcat output using the commons-logging functionality; or B) get log4j
 >configured properly so that it will allow me to output debug messages. (If
I
 >need to go with the second option, it would be nice to have it output to a
 >log file specific to my application and not the Tomcat log file - although
 >I'm not sure how to go about configuring this.)
 >
 >
 >
 >Can anyone please get me started with this issue?
 >
 >
 >
 >Thanks,
 >
 >
 >
 >Darren


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org





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