You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mark Faircloth <Ma...@connaught.plc.uk> on 2007/07/13 12:23:27 UTC
Log4j errors on Tomcat6 startup
Hi,
We are in the process of migrating from 5.5 to 6 under Win32/64 and need
to alter the locations of some of our jars files because of the changes
to the directory structure and the class loading.
Under 5.5 we have commons-logging.jar and log4j.jar in WEB-INF\lib and
that works fine. For 6 we have put commons-logging and log4j.jar into
\lib otherwise it fails on loading any context listeners. We also have a
copy of log4j.jar still in WEB-INF\lib for webapp specific logging
pretty much as the documentation states.
This all runs okay and we get the output we would expect but on start-up
we get errors in the stdout log such as:
log4j:ERROR A "org.apache.log4j.DailyRollingFileAppender" object is not
assignable to a "org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
log4j:ERROR [org.apache.catalina.loader.StandardClassLoader@bbe0f0a]
whereas object of type
log4j:ERROR "org.apache.log4j.DailyRollingFileAppender" was loaded by
[WebappClassLoader
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@bbe0f0a
].
log4j:ERROR Could not instantiate appender named "MAIN".
Understandably considering we are class loading in two places. My
question is, are these error messages really benign and can we get rid
of them somehow or are we doing something wrong and need to investigate
further?
Many thanks
Mark
Connaught wins RoSPA Gold Award for fifth year running
Considerate Contractor Gold Award in 2006
Partnering Contractor of the Year Award in 2005
Please visit our website to see a full list of Connaught's Registered Companies www.connaught.plc.uk/Investors/Registered-Companies
Disclaimer:
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete this message.
Connaught plc, Head Office 01392 444546
Re: Log4j errors on Tomcat6 startup
Posted by Gregor Schneider <rc...@googlemail.com>.
Hi Mark,
your application doesn't need the log4j*.jar since they are provided
by Tomcat 6 (unlike Tomcat 5.x).
However, your application should have it's own log4j-configuration aka
log4j.xml.
This file is usually found in
${CATALINA_HOME}/webapps/${your_application}/WEB-INF/classes
In this web-app-specific log4j-confugration you can declare / specify
your own log4j-appenders (output).
HTH
Gregor
--
what's puzzlin' you, is the nature of my game
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available @ http://pgpkeys.pca.dfn.de:11371
---------------------------------------------------------------------
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: Log4j errors on Tomcat6 startup
Posted by Mark Faircloth <Ma...@connaught.plc.uk>.
Thanks Juha,
But if we remove log4j from WEB-INF\lib we can't separate the messages
from the different webapps, we just end up with one log file. Also we
don't get any further errors reported.
The Tomcat 6 docs talks about setting up common logging and then goes on
to say:
"Your web applications should certainly use their own log4j
configuration. This is valid with the above configuration. You would
place a similar log4j.properties file in your web application's
WEB-INF/classes folder, and log4j1.2.8.jar into WEB-INF/lib. Then
specify your package level logging. This is a basic setup of log4j which
does *not* require Commons-Logging"
So we aren't doing anything unusual.
Debugging the log4j we can see it loading all jars and all properties
files.
We have also noticed that although we get messages in the correct log
files they only seem to be from context listener classes and nothing
else.
Any other way to get separate log files for each webapp?
Mark
-----Original Message-----
From: Juha Laiho [mailto:Juha.Laiho@iki.fi]
Sent: 16 July 2007 07:36
To: Tomcat Users List
Subject: Re: Log4j errors on Tomcat6 startup
Mark Faircloth wrote:
> We are in the process of migrating from 5.5 to 6 under Win32/64 and
need
> to alter the locations of some of our jars files because of the
changes
> to the directory structure and the class loading.
>
> Under 5.5 we have commons-logging.jar and log4j.jar in WEB-INF\lib and
> that works fine. For 6 we have put commons-logging and log4j.jar into
> \lib otherwise it fails on loading any context listeners. We also have
a
> copy of log4j.jar still in WEB-INF\lib for webapp specific logging
> pretty much as the documentation states.
>
> This all runs okay and we get the output we would expect but on
start-up
> we get errors in the stdout log such as:
>
> log4j:ERROR A "org.apache.log4j.DailyRollingFileAppender" object is
not
> assignable to a "org.apache.log4j.Appender" variable.
... [error detail describing that classes were loaded by separate
loaders]
> log4j:ERROR Could not instantiate appender named "MAIN".
>
> Understandably considering we are class loading in two places. My
> question is, are these error messages really benign and can we get rid
> of them somehow or are we doing something wrong and need to
investigate
> further?
You have a problem here; at least some parts of Log4j are in inoprative
state (and you could get more error messages of the same kind later on).
You should fix this by fixing the classloading issue (which pretty much
means throwing the jar files out of WEB-INF\lib), unless you can revert
the classloading structure back to what it was in TC 5.5 - which seems
unlikely.
--
..Juha
---------------------------------------------------------------------
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
Connaught wins RoSPA Gold Award for fifth year running
Considerate Contractor Gold Award in 2006
Partnering Contractor of the Year Award in 2005
Please visit our website to see a full list of Connaught's Registered Companies www.connaught.plc.uk/Investors/Registered-Companies
Disclaimer:
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete this message.
Connaught plc, Head Office 01392 444546
---------------------------------------------------------------------
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: Log4j errors on Tomcat6 startup
Posted by Juha Laiho <Ju...@iki.fi>.
Mark Faircloth wrote:
> We are in the process of migrating from 5.5 to 6 under Win32/64 and need
> to alter the locations of some of our jars files because of the changes
> to the directory structure and the class loading.
>
> Under 5.5 we have commons-logging.jar and log4j.jar in WEB-INF\lib and
> that works fine. For 6 we have put commons-logging and log4j.jar into
> \lib otherwise it fails on loading any context listeners. We also have a
> copy of log4j.jar still in WEB-INF\lib for webapp specific logging
> pretty much as the documentation states.
>
> This all runs okay and we get the output we would expect but on start-up
> we get errors in the stdout log such as:
>
> log4j:ERROR A "org.apache.log4j.DailyRollingFileAppender" object is not
> assignable to a "org.apache.log4j.Appender" variable.
... [error detail describing that classes were loaded by separate loaders]
> log4j:ERROR Could not instantiate appender named "MAIN".
>
> Understandably considering we are class loading in two places. My
> question is, are these error messages really benign and can we get rid
> of them somehow or are we doing something wrong and need to investigate
> further?
You have a problem here; at least some parts of Log4j are in inoprative
state (and you could get more error messages of the same kind later on).
You should fix this by fixing the classloading issue (which pretty much
means throwing the jar files out of WEB-INF\lib), unless you can revert
the classloading structure back to what it was in TC 5.5 - which seems
unlikely.
--
..Juha
---------------------------------------------------------------------
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