You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Rob Tanner <rt...@linfield.edu> on 2007/05/26 00:35:42 UTC

Can't seem to get logging to work in Tomcat 5.5.9

Hi,

I was originally planning to move to Tomcat 6 but backed off for a
number of reasons.  Now I have Tomcat 5.5.9 installed an working, except
for logging (and one other problem that I might be able to resolve on my
own if only I could get logging to work). 

I have never configured Tomcat to log using log4j (Tomcat 4.x's built-in
was sufficient).  Following the instructions on the website
(http://tomcat.apache.org/tomcat-5.5-doc/logging.html),  I creating a
log4j.properties file and placed it in common/classes -- the only change
I made on the example on the webpage was to replace a variable with an
absolute path:

log4j.rootLogger=DEBUG, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=/var/apache/jakarta-tomcat-5.5.9/logs/tomcat.log
log4j.appender.R.MaxFileSize=10MB
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n


I then put log4j-1.2.7.jar and commons-logging-1.1.jar jarfiles in
common/lib and started Tomcat. The instructions don't say anything about
doing anything else and I've not done very much with log4j other than
use it to enable syslog logging in various applications, but it's not
working.

Any ideas?

Thanks,
Rob


-- 
Rob Tanner
UNIX Services Manager
Linfield College, McMinnville OR


Re: Can't seem to get logging to work in Tomcat 5.5.9

Posted by Rob Tanner <rt...@linfield.edu>.
Georg,

Finally kind of solved my problem.  First, I went to a fresh install of 
5.5.23 and then added the log4j.properties file in 
${CATALINA_HOME}/common/classes and the log4j jar file in 
${CATALINA_HOME}/common/lib. No go.  So, thinking maybe the 
documentation was wrong, I moved the properties file to 
${CATALINA_HOME}/conf.  Again, no go.  The I copied it back to 
common/classes and therefore unintentionally left a copy in conf.  And 
suddenly things started working.  Of course, log level DEBUG is not 
terribly helpful in most cases (too much data) and so I modified the 
properties file, switching it to INFO and things broke.  Then I 
remembered the copy in conf and changed it.  What seems to be happening 
and makes no logical sense is that so long as I have identical copies of 
the log4j.properties file in conf and common/classes, everything works.  
I'm sure that somewhere, something is screwed up, but I have no idea 
what.  Weird!

-- Rob

On 05/31/2007 02:59 PM, Georg Sauer-Limbach wrote:
> Hi Rob,
>
> check catalina.out, there should be some message of
> log4j complaining if it has been loaded but cannot work.
>
> You may also add -Dlog4.debug to the java command line,
> this makes log4j output debug messages on stdout.
>
> If you don't see any output of log4j, then I'd suggest
> calling java with -verbose:class, this makes java
> print information about every class it loads and from
> which source it loaded it. Grep for log4j to see if it
> is at all loaded.
>
> Georg
>
>
> Rob Tanner wrote:
>> Hi,
>>
>> I was originally planning to move to Tomcat 6 but backed off for a
>> number of reasons.  Now I have Tomcat 5.5.9 installed an working, except
>> for logging (and one other problem that I might be able to resolve on my
>> own if only I could get logging to work).
>> I have never configured Tomcat to log using log4j (Tomcat 4.x's built-in
>> was sufficient).  Following the instructions on the website
>> (http://tomcat.apache.org/tomcat-5.5-doc/logging.html),  I creating a
>> log4j.properties file and placed it in common/classes -- the only change
>> I made on the example on the webpage was to replace a variable with an
>> absolute path:
>>
>> log4j.rootLogger=DEBUG, R
>> log4j.appender.R=org.apache.log4j.RollingFileAppender
>> log4j.appender.R.File=/var/apache/jakarta-tomcat-5.5.9/logs/tomcat.log
>> log4j.appender.R.MaxFileSize=10MB
>> log4j.appender.R.MaxBackupIndex=10
>> log4j.appender.R.layout=org.apache.log4j.PatternLayout
>> log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
>>
>>
>> I then put log4j-1.2.7.jar and commons-logging-1.1.jar jarfiles in
>> common/lib and started Tomcat. The instructions don't say anything about
>> doing anything else and I've not done very much with log4j other than
>> use it to enable syslog logging in various applications, but it's not
>> working.
>>
>> Any ideas?
>>
>> Thanks,
>> Rob
>>
>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


Re: Can't seem to get logging to work in Tomcat 5.5.9

Posted by Georg Sauer-Limbach <gs...@gslweb.de>.
Hi Rob,

check catalina.out, there should be some message of
log4j complaining if it has been loaded but cannot work.

You may also add -Dlog4.debug to the java command line,
this makes log4j output debug messages on stdout.

If you don't see any output of log4j, then I'd suggest
calling java with -verbose:class, this makes java
print information about every class it loads and from
which source it loaded it. Grep for log4j to see if it
is at all loaded.

Georg


Rob Tanner wrote:
> Hi,
> 
> I was originally planning to move to Tomcat 6 but backed off for a
> number of reasons.  Now I have Tomcat 5.5.9 installed an working, except
> for logging (and one other problem that I might be able to resolve on my
> own if only I could get logging to work). 
> 
> I have never configured Tomcat to log using log4j (Tomcat 4.x's built-in
> was sufficient).  Following the instructions on the website
> (http://tomcat.apache.org/tomcat-5.5-doc/logging.html),  I creating a
> log4j.properties file and placed it in common/classes -- the only change
> I made on the example on the webpage was to replace a variable with an
> absolute path:
> 
> log4j.rootLogger=DEBUG, R
> log4j.appender.R=org.apache.log4j.RollingFileAppender
> log4j.appender.R.File=/var/apache/jakarta-tomcat-5.5.9/logs/tomcat.log
> log4j.appender.R.MaxFileSize=10MB
> log4j.appender.R.MaxBackupIndex=10
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
> 
> 
> I then put log4j-1.2.7.jar and commons-logging-1.1.jar jarfiles in
> common/lib and started Tomcat. The instructions don't say anything about
> doing anything else and I've not done very much with log4j other than
> use it to enable syslog logging in various applications, but it's not
> working.
> 
> Any ideas?
> 
> Thanks,
> Rob
> 
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Can't seem to get logging to work in Tomcat 5.5.9

Posted by Tim Lucia <ti...@yahoo.com>.
I used your config file verbatim and it worked.  I can tell you it is not
your config file.  Is there any hint at all in the tomcat/logs directory?

Tim

________________________________________
From: Rob Tanner [mailto:rtanner@linfield.edu] 
Sent: Friday, May 25, 2007 7:40 PM
To: Tomcat Users List
Subject: Re: Can't seem to get logging to work in Tomcat 5.5.9

Tim,

Right now I'm running Tomcat as root so that it can grab ports 80 and 443 (I
understand there is a work around for that, but I'm not there yet) and so
permissions is not an issue.  I also wondered whether the file had to
already exist before it could log to it.  So I touched the file and that
made no difference.

Also, I tried removing the tomcat-juli.jar file from $CATALINA_HOME/bin and
that made no difference.  Just looking at the startup script, I don't think
JULI conflicts with log4j -- i.e., it doesn't look like if you use one you
can't use the other.

-- Rob

Tim Lucia said the following on 05/25/2007 03:59 PM: 
Your configuration file is valid.  Does the user Tomcat runs as have write
permission along the output path?  You could try using /tmp as a test.  If
it is not permissions, then it could be a classpath issue, but your notes
lead me to believe that not to be the case (i.e., you put them where they
should be.

You may (I'm fuzzy on this) have to rename the tomcat-juli.jar file, or
otherwise change the startup script(s) so that it doesn't use the juli
logger.

HTH,
Tim


  
-----Original Message-----
From: Rob Tanner [mailto:rtanner@linfield.edu]
Sent: Friday, May 25, 2007 6:36 PM
To: Tomcat Users List
Subject: Can't seem to get logging to work in Tomcat 5.5.9

Hi,

I was originally planning to move to Tomcat 6 but backed off for a
number of reasons.  Now I have Tomcat 5.5.9 installed an working, except
for logging (and one other problem that I might be able to resolve on my
own if only I could get logging to work).

I have never configured Tomcat to log using log4j (Tomcat 4.x's built-in
was sufficient).  Following the instructions on the website
(http://tomcat.apache.org/tomcat-5.5-doc/logging.html),  I creating a
log4j.properties file and placed it in common/classes -- the only change
I made on the example on the webpage was to replace a variable with an
absolute path:

log4j.rootLogger=DEBUG, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=/var/apache/jakarta-tomcat-5.5.9/logs/tomcat.log
log4j.appender.R.MaxFileSize=10MB
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n


I then put log4j-1.2.7.jar and commons-logging-1.1.jar jarfiles in
common/lib and started Tomcat. The instructions don't say anything about
doing anything else and I've not done very much with log4j other than
use it to enable syslog logging in various applications, but it's not
working.

Any ideas?

Thanks,
Rob


--
Rob Tanner
UNIX Services Manager
Linfield College, McMinnville OR
    




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org

  




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Can't seem to get logging to work in Tomcat 5.5.9

Posted by Rob Tanner <rt...@linfield.edu>.
Tim,

Right now I'm running Tomcat as root so that it can grab ports 80 and
443 (I understand there is a work around for that, but I'm not there
yet) and so permissions is not an issue. I also wondered whether the
file had to already exist before it could log to it. So I touched the
file and that made no difference.

Also, I tried removing the tomcat-juli.jar file from $CATALINA_HOME/bin
and that made no difference. Just looking at the startup script, I don't
think JULI conflicts with log4j -- i.e., it doesn't look like if you use
one you can't use the other.

-- Rob

Tim Lucia said the following on 05/25/2007 03:59 PM:
> Your configuration file is valid.  Does the user Tomcat runs as have write
> permission along the output path?  You could try using /tmp as a test.  If
> it is not permissions, then it could be a classpath issue, but your notes
> lead me to believe that not to be the case (i.e., you put them where they
> should be.
>
> You may (I'm fuzzy on this) have to rename the tomcat-juli.jar file, or
> otherwise change the startup script(s) so that it doesn't use the juli
> logger.
>
> HTH,
> Tim
>
>
>   
>> -----Original Message-----
>> From: Rob Tanner [mailto:rtanner@linfield.edu]
>> Sent: Friday, May 25, 2007 6:36 PM
>> To: Tomcat Users List
>> Subject: Can't seem to get logging to work in Tomcat 5.5.9
>>
>> Hi,
>>
>> I was originally planning to move to Tomcat 6 but backed off for a
>> number of reasons.  Now I have Tomcat 5.5.9 installed an working, except
>> for logging (and one other problem that I might be able to resolve on my
>> own if only I could get logging to work).
>>
>> I have never configured Tomcat to log using log4j (Tomcat 4.x's built-in
>> was sufficient).  Following the instructions on the website
>> (http://tomcat.apache.org/tomcat-5.5-doc/logging.html),  I creating a
>> log4j.properties file and placed it in common/classes -- the only change
>> I made on the example on the webpage was to replace a variable with an
>> absolute path:
>>
>> log4j.rootLogger=DEBUG, R
>> log4j.appender.R=org.apache.log4j.RollingFileAppender
>> log4j.appender.R.File=/var/apache/jakarta-tomcat-5.5.9/logs/tomcat.log
>> log4j.appender.R.MaxFileSize=10MB
>> log4j.appender.R.MaxBackupIndex=10
>> log4j.appender.R.layout=org.apache.log4j.PatternLayout
>> log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
>>
>>
>> I then put log4j-1.2.7.jar and commons-logging-1.1.jar jarfiles in
>> common/lib and started Tomcat. The instructions don't say anything about
>> doing anything else and I've not done very much with log4j other than
>> use it to enable syslog logging in various applications, but it's not
>> working.
>>
>> Any ideas?
>>
>> Thanks,
>> Rob
>>
>>
>> --
>> Rob Tanner
>> UNIX Services Manager
>> Linfield College, McMinnville OR
>>     
>
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>   


RE: Can't seem to get logging to work in Tomcat 5.5.9

Posted by Tim Lucia <ti...@yahoo.com>.
Your configuration file is valid.  Does the user Tomcat runs as have write
permission along the output path?  You could try using /tmp as a test.  If
it is not permissions, then it could be a classpath issue, but your notes
lead me to believe that not to be the case (i.e., you put them where they
should be.

You may (I'm fuzzy on this) have to rename the tomcat-juli.jar file, or
otherwise change the startup script(s) so that it doesn't use the juli
logger.

HTH,
Tim


> -----Original Message-----
> From: Rob Tanner [mailto:rtanner@linfield.edu]
> Sent: Friday, May 25, 2007 6:36 PM
> To: Tomcat Users List
> Subject: Can't seem to get logging to work in Tomcat 5.5.9
> 
> Hi,
> 
> I was originally planning to move to Tomcat 6 but backed off for a
> number of reasons.  Now I have Tomcat 5.5.9 installed an working, except
> for logging (and one other problem that I might be able to resolve on my
> own if only I could get logging to work).
> 
> I have never configured Tomcat to log using log4j (Tomcat 4.x's built-in
> was sufficient).  Following the instructions on the website
> (http://tomcat.apache.org/tomcat-5.5-doc/logging.html),  I creating a
> log4j.properties file and placed it in common/classes -- the only change
> I made on the example on the webpage was to replace a variable with an
> absolute path:
> 
> log4j.rootLogger=DEBUG, R
> log4j.appender.R=org.apache.log4j.RollingFileAppender
> log4j.appender.R.File=/var/apache/jakarta-tomcat-5.5.9/logs/tomcat.log
> log4j.appender.R.MaxFileSize=10MB
> log4j.appender.R.MaxBackupIndex=10
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
> 
> 
> I then put log4j-1.2.7.jar and commons-logging-1.1.jar jarfiles in
> common/lib and started Tomcat. The instructions don't say anything about
> doing anything else and I've not done very much with log4j other than
> use it to enable syslog logging in various applications, but it's not
> working.
> 
> Any ideas?
> 
> Thanks,
> Rob
> 
> 
> --
> Rob Tanner
> UNIX Services Manager
> Linfield College, McMinnville OR




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org