logging setup problem with tomcat5.5.7 .... need help please.

logging setup problem with tomcat5.5.7 .... need help please.

Post by jim shirre » Sun, 13 Nov 2005 03:11:09


I have tried just about everything to get logging working in tomcat5.5.7.
Can anyone tell me how to get container level logging working? I keep
getting this error
log4j:WARN No appenders could be found for logger
(org.apache.catalina.startup.ClassLoaderFactory). log4j:WARN Please
initialize the log4j system properly.

This problem is happening on two diferent tomcat installs, I have been to
Apacte site and done everything thier docs say to do. And still logging does
not work.

thanks js
 
 
 

logging setup problem with tomcat5.5.7 .... need help please.

Post by HalcyonWil » Sun, 13 Nov 2005 03:50:12


I too get this warning , somebody else set it up for me. It works fine
with me. I am able to write to the logs in my code.
Must be something else Jim. Can you post your log4j.properties, so that
someone who has a working sample can compare.

 
 
 

logging setup problem with tomcat5.5.7 .... need help please.

Post by jim shirre » Sun, 13 Nov 2005 04:01:45

I do not use a log4i properties file, I was happy with the default Tomcat
logging in previous Tomcats.
I think I must have a lo4j problem or a common-logging problem. If I could
get any kind of logging working I would be happy.

I will look around for a log4j.properties file and drop that into
common/classses and see what happens

jim
 
 
 

logging setup problem with tomcat5.5.7 .... need help please.

Post by HalcyonWil » Sun, 13 Nov 2005 04:11:41


You top posted so I deleted the below stuff, creates a bit of confusion
here.

I hope you are putting the correct logging level in log4j.properties
for your package. Make the root category as the lowest level of log,
otherwise.

Also, use logger.log for test, so that they get printed, whatever the
log level.
And yes, it seems to me that log4j.properties should be in the
classpath. Not sure about this though.
 
 
 

logging setup problem with tomcat5.5.7 .... need help please.

Post by jim shirre » Sun, 13 Nov 2005 09:48:24


Sorry bout the top posting, been a while since I posted on usenet news, I
can usally google and find a solution to whatever problem I am having, but
this one is driving me crazy. I am going to remove every damn
log4j.properties on this computer. I have been building axis/hibernate
applications and perhaps Tomcat is picking up one of those which might be my
problem. If that does not work then I'll try a reinstall of Tomcat. Thanks
for the reply

jim
 
 
 

logging setup problem with tomcat5.5.7 .... need help please.

Post by HalcyonWil » Sun, 13 Nov 2005 10:46:22


Jim, take a look at this, I found this on the Jboss site.

http://www.yqcomputer.com/ #d0e256

Here it talks about log4j.xml file. My project uses the properties
file. See if this might help. I think you need to specify the Appender
class name in properties/xml, which might not be included in your
classpath. Try putting both the log4j prop/xml file in the classpath,
as well as the logging classes. I guess tomcat also has its own logging
classes, which you need to include in classpath.

<appender name="CMP"
class="org.jboss.logging.appender.RollingFileAppender">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>

<param name="File" value="${jboss.server.home.dir}/log/cmp.log"/>
<param name="Append" value="false"/>
<param name="MaxFileSize" value="500KB"/>
<param name="MaxBackupIndex" value="1"/>

<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
</layout>
</appender>

<category name="org.jboss.ejb.plugins.cmp">
<priority value="DEBUG" />
<appender-ref ref="CMP"/>
</category>
 
 
 

logging setup problem with tomcat5.5.7 .... need help please.

Post by jim shirre » Sun, 13 Nov 2005 14:51:50

"HalcyonWild" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...

Thanks I will read the docs and try again tomorrow, calling it a night.

Appreciate the help, these configuration issues drive me crazy, I am almost
done with a really neat application and all I need to do is debug a little
axis problem, but I can't do that if the damn Tomcat logging won't work.

thanks again
jim


 
 
 

logging setup problem with tomcat5.5.7 .... need help please.

Post by Juha Laih » Mon, 14 Nov 2005 04:33:45

"jim shirreffs" < XXXX@XXXXX.COM > said:

Let's gather some data.

Tomcat in itself doesn't contain log4j, so you've placed a log4j
library somewhere, and are apparently also using it somewhere.
If you're using it, you're hopefully also configuring it - how else
could anything be logged, because log4j wouldn't know where to write.

Where exactly did you drop the log4j library? This is important in the
sense that Tomcat used Jakarta commons-logging for its internal logging,
and commons-logging in turn will by default use log4j whenever it is
available. So just throwing a log4j library into a Tomcat installation
has good probability of messing up Tomcat internal logging.

What configuration method are you using for log4j? Is log4j picking
up the configuration? Start Tomcat with -Dlog4j.debug=true in
JAVA_OPTS to find out.

It is also possible to force commons-logging to use a specific logging
backend (note though that if any of your applications run within the
same Tomcat instance use commons-logging, this setting will also affect
those applications). To force commons-logging to not use log4j as
the backend, add
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger
to JAVA_OPTS in tomcat startup and restart Tomcat.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
 
 
 

logging setup problem with tomcat5.5.7 .... need help please.

Post by jim shirre » Mon, 14 Nov 2005 06:41:45

"Juha Laiho" < XXXX@XXXXX.COM > wrote in message
news:dl5g2p$u4$ XXXX@XXXXX.COM ...

I have removed all log4j.jars except the jar in jre/lib/ext, and
Tomcat/common/lib, my Tomcat will not start without the
jre/lib/ext/log4j.jar which I find curious since common/lib is where I
thougt all Tomcat required jars should go. I have also removed all the
log4j.properties files I could find.

My thinking is that Tomcat will default to it's own logging mechanism if
nothing else is available (used to work that way).

Other then server.xml I do not touch Tomcat configuration files. So I
basicly install, modify the server.xml and then run. I also do not use a
classpath when running Tomcat, so the only thing Tomcat should see the
jre/lib/ext and it's own stuff. I did manage to get Tomcat to at least
create log files on one computer (reinstalled everything) but it never
writes to them, the other computer does not even create the log files.

This problem is really hurting me as I am trying to develope a
axis/hibernate application but I can't debug without Tomcat logs. I've used
Tomcat for years and years without any problems.

What I probably need is a boiler plate lo4j.properties file for Tomcat that
I can put into common/classes , but the install does not contain one. I've
tried the following as a log4j.properties file but without success.

# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=DEBUG, A1

# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

Thank you for your interest.

jim s


 
 
 

logging setup problem with tomcat5.5.7 .... need help please.

Post by Juha Laih » Mon, 14 Nov 2005 21:05:12

jim shirreffs" < XXXX@XXXXX.COM > said:

jre/lib/ext is at least part of the bootstrap classpath, and I think it
could make its way to some other Tomcat classpaths as well. But now,
what in your setup does require log4j, as plain Tomcat works without
log4j just fine?


The logging mechanism used by Tomcat is Jakarta commons-logging
package, and by default it will use either log4j, the JDK 1.4 logging
subsystem, or its internal simple logger (in this order, as support
classes are found). But as I wrote earlier, this can be overridden with
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger
in JAVA_OPTS at tomcat startup. Could you see if this helps you?


Well, log4j doesn't end in jre/lib/ext by itself, so someone did place
it there. Looks like you should go back to a very clean situation and
trace forward step by step from there, to find out which of your
installs do what behind the scenes. You clearly are not in control of
the situation any more. Stop chaos, take control. Then start building
gain, step by step - and paying attention to what all happens. Then,
if something unexpected happens, you can backtrack just a single step,
instead of redo-all.


Don't stagger in the darkness. Find a place where you know which
pieces are affecting the play - and control the playground yourself.
So, don't just place things all over by random guesses - looks
like that's how you ended in your current situation in the first
place.

So, things to determine:
- what in your system requires log4j; is it an essential part of
your environment; is jre/lib/ext really the proper place for log4j
- is Tomcat the only thing in your environment using commons-logging;
if so, force commons-logging to revert to other logging backends
instead of using log4j (if you can't place log4j into such a place
that it doesn't affect Tomcat internals, but still is available to
webapps)

--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
 
 
 

logging setup problem with tomcat5.5.7 .... need help please.

Post by jim shirre » Tue, 15 Nov 2005 00:33:46

ell I found the problem, or rather I found where the problem is, something
in my lib/ext was screwing up Tomcat logging. I removed the lib/ext
directory and logging started working. Now I will look at every jar in
lib/ext and find the offended jar.

thanks HalcyonWild and Juha Laiho

jim s

"Juha Laiho" < XXXX@XXXXX.COM > wrote in message
news:dl7a5o$mbd$ XXXX@XXXXX.COM ...