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 Wed, 14 Jun 2006 13:30:13 GMT
I have confirmed that my log files are not being created anywhere on my test
server (I did a windows search of the C: drive with no results).

As was stated here, there are probably two reasons this could be happening:
1) Log4j is not creating the "log" directory, thus it can't create the log
file; or
2) I'm missing the piece to connect my application to log4j. In my code, I
create a variable using the following statement:

"protected static Log log = LogFactory.getLog(ControllerServlet.class);"

Now is that enough for commons-logging and log4j to create the log file they
need, or am I missing another piece somewhere?

I don't think that setting the log level to debug will help things at this
point. Also if I need to specify a full path for the log files, I don't
think I want the logs showing up under the [CATALINA_HOME]/bin directory. Is
there a standard location where my log files should be kept? (Not that this
is that important, but if there is a standard I'm unaware of, I'd like to
conform to it.)

Thanks,

Darren


-----Original Message-----
From: Jacob Kjome [mailto:hoju@visi.com] 
Sent: Wednesday, June 14, 2006 12:34 AM
To: Log4J Users List
Subject: RE: setting up log4j


try adding <level value="debug"/> to your <root> logger and see what 
happens.  Also, do you see your log files getting created?  Based on 
what you have written, if you start up Tomcat using the default 
scripts, they would end up in "CATALINA_HOME/bin/logs".  Of course, 
since Tomcat doesn't create directories when writing log files, if 
the bin/logs directory doesn't exist, no log files will be 
written.  Create the logs directory yourself and then start Tomcat, 
in that case.

Jake

At 04:07 PM 6/13/2006, you wrote:
 >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


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