Pedro wrote:
> > My log4j.properties is defined like this:
> > log4j.rootLogger=,NGIN
> > log4j.category.PT.ptinovacao.ngincare=NGIN
> > log4j.appender.NGIN=org.apache.log4j.ConsoleAppender
> > log4j.appender.NGIN.layout=org.apache.log4j.PatternLayout
> > log4j.appender.NGIN.layout.ConversionPattern=%-4r [%t] %-5p %c %x -
> [THE PROBLEM NOW]
> 5)now I get the log of my web application generated by the container in
> the specific log file, but the log I use through log4j appears in
> catalina.out!! How can I redirect this log also to the specific file??
As far as I can tell, the output is going where you told it to go-- you're
using a ConsoleAppender, and it's going to the console (which on some
systems ends up in catalina.out).
I don't know you can [or should] log to the same file as Tomcat is using.
To send log4j output to a file, I use this:
# Create an appender called daily:
log4j.rootLogger=DEBUG, daily
# Create a category for each class, set the level and appender:
log4j.category.test.LoggingTest=DEBUG, daily
# Configure the daily appender to be a DailyRollingFileAppender
log4j.appender.daily=org.apache.log4j.DailyRollingFileAppender
# Configure the name of the logout for the daily appender
# default location when used with Tomcat is is /path/to/tomcat/bin,
# so back up one & go into logs
log4j.appender.daily.File=../logs/bendev.log
# Configure the layout pattern and conversion pattern for the daily appender
log4j.appender.daily.layout=org.apache.log4j.PatternLayout
log4j.appender.daily.layout.ConversionPattern=%d{ABSOLUTE} - %p %c - %m%n
Unfortunately, my daily rolling file appender did not roll this morning, so
I'm off to figure out how to make it do that, but it is at least writing to
the correct file.
My remaining problem is that using ../logs/filename.log for the File only
works when running from Tomcat. If I run any tests from the prompt, the
logs try to go to ../logs relative to the directory I'm in at the time.
HTH,
--
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University PA Information Resources Management