You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Avi Deitcher <av...@deitcher.net> on 2006/07/02 04:26:30 UTC
log4j in webapp hanging Tomcat?
Has anyone seen this or know how to work around it?
I have a webapp deployed on Tomcat 5.5.16 (FWIW, the bundled version
that came with Netbeans 5.5). In order to do its own logging, the webapp
has log4j-1.2.8.jar deployed in WEB-INF/lib/. and log4j.properties in
WEB-INF/classes/. The properties is very simple, as follows below:
# log4j configuration file
# Set root category priority to ERROR and set its only appender to A1
log4j.rootCategory=ERROR, A1
# here is the A1 appender
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d [%t] %p %c %x.%M - %m%n.
# finally, any that are set
#log4j.category.tester=DEBUG
The simple classes (a JSF backing bean and a filter) are set to use
either commons-logging or log4j directly (I tried both). In either case,
the moment that I uncomment any category line and one of my classes (the
filter or the bean) calls log.debug("some message"), Tomcat freezes
entirely. This is true whether I use log4j directly or commons-logging
in my classes, and whether or not I comment or uncomment the first
log4j.rootCategory line in log4j.properties. I get some output from the
appender matching the pattern, and then freeze. I cannot access any
context; I cannot use the manager; the only thing I can do is kill the
Tomcat process.
I am at wit's end with this; it took literally days to narrow down that
it was log4j's activation doing it.
Help?
Thanks.
--
______________________________
Avi Deitcher
avi@deitcher.net
---------------------------------------------------------------------
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 in webapp hanging Tomcat?
Posted by Avi Deitcher <av...@deitcher.net>.
Add to the weirdness. Following
http://tomcat.apache.org/tomcat-5.5-doc/logging.html I decided to try
and enable log4j logging in Tomcat itself via
commons/classes/log4j.properties and common/lib/log4j-1.2.8.jar,
figuring it would help me narrow it down. This, *too* causes Tomcat to
hang, at this point here:
.2006-07-02 07:27:08,165 [main] DEBUG
org.apache.catalina.loader.WebappClassLoader .loadClass - Loading
class from local repository
.2006-07-02 07:27:08,165 [main] DEBUG
org.apache.catalina.loader.WebappClassLoader .loadClass -
loadClass(com.sun.el.ValueExpressionLiteral, false)
.2006-07-02 07:27:08,165 [main] DEBUG
org.apache.catalina.loader.WebappClassLoader .loadClass - Searching
local repositories
.2006-07-02 07:27:08,165 [main] DEBUG
org.apache.catalina.loader.WebappClassLoader .findClass -
findClass(com.sun.el.ValueExpressionLiteral)
.2006-07-02 07:27:08,165 [main] DEBUG
org.apache.catalina.loader.WebappClassLoader .findClass -
findClassInternal(com.sun.el.ValueExpressionLiteral)
.2006-07-02 07:27:08,165 [main] DEBUG
org.apache.catalina.loader.WebappClassLoader .loadClass -
loadClass(java.io.Externalizable, false)
.2006-07-02 07:27:08,165 [main] DEBUG
org.apache.catalina.loader.WebappClassLoader .findClass -
Returning class class com.sun.el.ValueExpressionLiteral
.2006-07-02 07:27:08,165 [main] DEBUG
org.apache.catalina.loader.WebappClassLoader .findClass - Loaded
by WebappClassLoader
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@b2c6a6
.2006-07-02 07:27:08,175 [main] DEBUG
org.apache.catalina.loader.WebappClassLoader .loadClass - Loading
class from local repository
I note that it occurs during the EL loading, could it be an EL <-> log4j
conflict?
Boris Unckel wrote:
> Hello Avi,
>
> Avi Deitcher wrote:
>
>> Bob,
>>
>> Thanks. Unfortunately, I am running it on my laptop (Windows) where I
>> need to keep it for now as a dev environment. I run a small consulting
>> business, this is an "on the side" product that need to be run whenever
>> I can catch time.
>>
>> I would love to be able to get Tomcat to tell me what it is doing, but I
>> am afraid that enabling logging in Tomcat itself might pollute the
>> environment and make the problem worse.
>>
>> Ironically, Tomcat has neither log4j nor commons-logging in its
>> $TOMCAT_HOME/common/lib nor server/lib, which makes me wonder how it is
>> using commons-logging in its own classes at all....
>
> by default the internal logging of Tomcat 5.5 is done via
> commons-logging to Tomcat-juli, which
> itself is a java.util.logging implementation.
> If you remove any direct log4j calls from your webapp and configure
> apache-tomcat-5.5.16\conf\logging.properties
> properly, you will use the same system by default.
>
> Have a look at:
> http://tomcat.apache.org/tomcat-5.5-doc/logging.html
> http://tomcat.apache.org/faq/logging.html
> http://jakarta.apache.org/commons/logging/
> http://jakarta.apache.org/commons/logging/commons-logging-1.1/troubleshooting.html
>
> http://wiki.apache.org/jakarta-commons/Logging
>
> Maybe you are interested in a more extended version:
> http://www.x4juli.org
>
> Regards
> Boris
>
> ---------------------------------------------------------------------
> 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
>
--
______________________________
Avi Deitcher
avi@deitcher.net
---------------------------------------------------------------------
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 in webapp hanging Tomcat?
Posted by Avi Deitcher <av...@deitcher.net>.
I misspoke. Over 2GB free on the disk. Not a ton, but more than enough
for logs. Thanks for the suggestion, though.
Pid wrote:
>Dumb question perhaps, but has your disk got enough space?
>
>Avi Deitcher wrote:
>
>
>>Boris,
>>
>>Thank you, I should get to trying it this evening EDT.
>>
>>One other thing I will try it enabling logging in core Tomcat from JDK
>>logging as opposed to log4j, to see if I can get Tomcat to tell me where
>>it is hanging. In the same vein, do you know if there is a truss-like
>>equivalent for WinXP?
>>
>>As for netbeans, I will try it standalone, but to be honest, it is
>>unlikely, since Netbeans starts a separate OS process, and I can
>>actually control the command-line options separately. I believe it is
>>just a convenience method. But I will try it to be sure.
>>
>>I will try all of the above and let you know what I find.
>>Avi
>>
>>Boris Unckel wrote:
>>
>>
>>
>>>Hello Avi,
>>>
>>>Avi Deitcher wrote:
>>>
>>>
>>>
>>>>Boris,
>>>>
>>>>Thank you, too. The main issue here is that I *do* want to separate my
>>>>webapp's logging from Tomcat's, so it can be fully self-contained.
>>>>Hence, I included log4j.jar and log4j.properties within my own webapp,
>>>>which should make a lot of sense. In the development case, I am pushing
>>>>the logs to the console, which end up intermixes with Tomcat's logs, but
>>>>that is an easy switch in log4j.properties. Also, it appears that
>>>>x4juli, according to the Website, is not quite ready for production.
>>>>
>>>>Any idea why this would cause hanging?
>>>>Avi
>>>>
>>>>
>>>If there is really a conflict between el and logj4j, try out the
>>>following to be sure:
>>>Please use the highest available version of log4j and commons-logging:
>>>http://logging.apache.org/log4j/docs/download.html
>>>http://jakarta.apache.org/site/downloads/downloads_commons-logging.cgi
>>>
>>>Follow the instructions in
>>>http://wiki.apache.org/jakarta-commons/Commons_Logging_FUD
>>>to separate container commons-logging and webapps commons-logging.
>>>
>>>Put log4j.jar in $CATALINA_HOME/server/lib and a log4j.properties in
>>>$CATALINA_HOME/server/classes
>>>
>>>Take care to remove any log4j.jar and commons-logging-xx.jar from
>>>$CATALINA_HOME/common/lib
>>>or $CATALINA_HOME/shared/lib
>>>
>>>Take care that commons-logging or log4j is not present at
>>>system-classpath due to your startup with Netbeans,
>>>this may cause the problem. (Does the problem only occur with startup
>>>in Netbeans? Does it occur standalone, too?)
>>>
>>>Put in logj4.jar in WEB-INF/lib and log4j.properties in
>>>WEB-INF/classes as you desired with a webapp specific
>>>configuration.
>>>
>>>Regards
>>>Boris
>>>
>>>
>>>---------------------------------------------------------------------
>>>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
>
>
>
--
______________________________
Avi Deitcher
avi@deitcher.net
Re: log4j in webapp hanging Tomcat?
Posted by Avi Deitcher <av...@deitcher.net>.
Not a dumb question at all; isn't it often the obvious?
I actually am low on disk space, but not low enough that it should
matter. Still, I will clean up an extra 1GB just to see.
Pid wrote:
>Dumb question perhaps, but has your disk got enough space?
>
>Avi Deitcher wrote:
>
>
>>Boris,
>>
>>Thank you, I should get to trying it this evening EDT.
>>
>>One other thing I will try it enabling logging in core Tomcat from JDK
>>logging as opposed to log4j, to see if I can get Tomcat to tell me where
>>it is hanging. In the same vein, do you know if there is a truss-like
>>equivalent for WinXP?
>>
>>As for netbeans, I will try it standalone, but to be honest, it is
>>unlikely, since Netbeans starts a separate OS process, and I can
>>actually control the command-line options separately. I believe it is
>>just a convenience method. But I will try it to be sure.
>>
>>I will try all of the above and let you know what I find.
>>Avi
>>
>>Boris Unckel wrote:
>>
>>
>>
>>>Hello Avi,
>>>
>>>Avi Deitcher wrote:
>>>
>>>
>>>
>>>>Boris,
>>>>
>>>>Thank you, too. The main issue here is that I *do* want to separate my
>>>>webapp's logging from Tomcat's, so it can be fully self-contained.
>>>>Hence, I included log4j.jar and log4j.properties within my own webapp,
>>>>which should make a lot of sense. In the development case, I am pushing
>>>>the logs to the console, which end up intermixes with Tomcat's logs, but
>>>>that is an easy switch in log4j.properties. Also, it appears that
>>>>x4juli, according to the Website, is not quite ready for production.
>>>>
>>>>Any idea why this would cause hanging?
>>>>Avi
>>>>
>>>>
>>>If there is really a conflict between el and logj4j, try out the
>>>following to be sure:
>>>Please use the highest available version of log4j and commons-logging:
>>>http://logging.apache.org/log4j/docs/download.html
>>>http://jakarta.apache.org/site/downloads/downloads_commons-logging.cgi
>>>
>>>Follow the instructions in
>>>http://wiki.apache.org/jakarta-commons/Commons_Logging_FUD
>>>to separate container commons-logging and webapps commons-logging.
>>>
>>>Put log4j.jar in $CATALINA_HOME/server/lib and a log4j.properties in
>>>$CATALINA_HOME/server/classes
>>>
>>>Take care to remove any log4j.jar and commons-logging-xx.jar from
>>>$CATALINA_HOME/common/lib
>>>or $CATALINA_HOME/shared/lib
>>>
>>>Take care that commons-logging or log4j is not present at
>>>system-classpath due to your startup with Netbeans,
>>>this may cause the problem. (Does the problem only occur with startup
>>>in Netbeans? Does it occur standalone, too?)
>>>
>>>Put in logj4.jar in WEB-INF/lib and log4j.properties in
>>>WEB-INF/classes as you desired with a webapp specific
>>>configuration.
>>>
>>>Regards
>>>Boris
>>>
>>>
>>>---------------------------------------------------------------------
>>>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
>
>
>
--
______________________________
Avi Deitcher
avi@deitcher.net
Re: log4j in webapp hanging Tomcat?
Posted by Pid <p...@pidster.com>.
Dumb question perhaps, but has your disk got enough space?
Avi Deitcher wrote:
> Boris,
>
> Thank you, I should get to trying it this evening EDT.
>
> One other thing I will try it enabling logging in core Tomcat from JDK
> logging as opposed to log4j, to see if I can get Tomcat to tell me where
> it is hanging. In the same vein, do you know if there is a truss-like
> equivalent for WinXP?
>
> As for netbeans, I will try it standalone, but to be honest, it is
> unlikely, since Netbeans starts a separate OS process, and I can
> actually control the command-line options separately. I believe it is
> just a convenience method. But I will try it to be sure.
>
> I will try all of the above and let you know what I find.
> Avi
>
> Boris Unckel wrote:
>
>> Hello Avi,
>>
>> Avi Deitcher wrote:
>>
>>> Boris,
>>>
>>> Thank you, too. The main issue here is that I *do* want to separate my
>>> webapp's logging from Tomcat's, so it can be fully self-contained.
>>> Hence, I included log4j.jar and log4j.properties within my own webapp,
>>> which should make a lot of sense. In the development case, I am pushing
>>> the logs to the console, which end up intermixes with Tomcat's logs, but
>>> that is an easy switch in log4j.properties. Also, it appears that
>>> x4juli, according to the Website, is not quite ready for production.
>>>
>>> Any idea why this would cause hanging?
>>> Avi
>> If there is really a conflict between el and logj4j, try out the
>> following to be sure:
>> Please use the highest available version of log4j and commons-logging:
>> http://logging.apache.org/log4j/docs/download.html
>> http://jakarta.apache.org/site/downloads/downloads_commons-logging.cgi
>>
>> Follow the instructions in
>> http://wiki.apache.org/jakarta-commons/Commons_Logging_FUD
>> to separate container commons-logging and webapps commons-logging.
>>
>> Put log4j.jar in $CATALINA_HOME/server/lib and a log4j.properties in
>> $CATALINA_HOME/server/classes
>>
>> Take care to remove any log4j.jar and commons-logging-xx.jar from
>> $CATALINA_HOME/common/lib
>> or $CATALINA_HOME/shared/lib
>>
>> Take care that commons-logging or log4j is not present at
>> system-classpath due to your startup with Netbeans,
>> this may cause the problem. (Does the problem only occur with startup
>> in Netbeans? Does it occur standalone, too?)
>>
>> Put in logj4.jar in WEB-INF/lib and log4j.properties in
>> WEB-INF/classes as you desired with a webapp specific
>> configuration.
>>
>> Regards
>> Boris
>>
>>
>> ---------------------------------------------------------------------
>> 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: log4j in webapp hanging Tomcat?
Posted by Avi Deitcher <av...@deitcher.net>.
Boris,
Thank you, I should get to trying it this evening EDT.
One other thing I will try it enabling logging in core Tomcat from JDK
logging as opposed to log4j, to see if I can get Tomcat to tell me where
it is hanging. In the same vein, do you know if there is a truss-like
equivalent for WinXP?
As for netbeans, I will try it standalone, but to be honest, it is
unlikely, since Netbeans starts a separate OS process, and I can
actually control the command-line options separately. I believe it is
just a convenience method. But I will try it to be sure.
I will try all of the above and let you know what I find.
Avi
Boris Unckel wrote:
> Hello Avi,
>
> Avi Deitcher wrote:
>
>> Boris,
>>
>> Thank you, too. The main issue here is that I *do* want to separate my
>> webapp's logging from Tomcat's, so it can be fully self-contained.
>> Hence, I included log4j.jar and log4j.properties within my own webapp,
>> which should make a lot of sense. In the development case, I am pushing
>> the logs to the console, which end up intermixes with Tomcat's logs, but
>> that is an easy switch in log4j.properties. Also, it appears that
>> x4juli, according to the Website, is not quite ready for production.
>>
>> Any idea why this would cause hanging?
>> Avi
>
> If there is really a conflict between el and logj4j, try out the
> following to be sure:
> Please use the highest available version of log4j and commons-logging:
> http://logging.apache.org/log4j/docs/download.html
> http://jakarta.apache.org/site/downloads/downloads_commons-logging.cgi
>
> Follow the instructions in
> http://wiki.apache.org/jakarta-commons/Commons_Logging_FUD
> to separate container commons-logging and webapps commons-logging.
>
> Put log4j.jar in $CATALINA_HOME/server/lib and a log4j.properties in
> $CATALINA_HOME/server/classes
>
> Take care to remove any log4j.jar and commons-logging-xx.jar from
> $CATALINA_HOME/common/lib
> or $CATALINA_HOME/shared/lib
>
> Take care that commons-logging or log4j is not present at
> system-classpath due to your startup with Netbeans,
> this may cause the problem. (Does the problem only occur with startup
> in Netbeans? Does it occur standalone, too?)
>
> Put in logj4.jar in WEB-INF/lib and log4j.properties in
> WEB-INF/classes as you desired with a webapp specific
> configuration.
>
> Regards
> Boris
>
>
> ---------------------------------------------------------------------
> 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
>
--
______________________________
Avi Deitcher
avi@deitcher.net
---------------------------------------------------------------------
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 in webapp hanging Tomcat?
Posted by Avi Deitcher <av...@deitcher.net>.
Wade,
Definitely no CPU spin. I also checked for some weird JDK dependency
(say, 1.5.0 vs 1.5.0_02 vs 1.5.0_07), but all give the same.
I modifed logging.properties in conf/ and had it dump ALL. Here is where
it hangs, right after I had it spit out the first logger.debug("some
message") in one of my classes in the webapp:
// lots before
FINE: Loading class from local repository
Jul 2, 2006 9:06:16 PM org.apache.catalina.loader.WebappClassLoader
loadClass
FINE: loadClass(java.util.Stack, false)
Jul 2, 2006 9:06:16 PM org.apache.catalina.loader.WebappClassLoader
loadClass
FINE: loadClass(org.apache.log4j.spi.LocationInfo, false)
Jul 2, 2006 9:06:16 PM org.apache.catalina.loader.WebappClassLoader
loadClass
FINE: Searching local repositories
Jul 2, 2006 9:06:16 PM org.apache.catalina.loader.WebappClassLoader
findClass
FINE: findClass(org.apache.log4j.spi.LocationInfo)
Jul 2, 2006 9:06:16 PM org.apache.catalina.loader.WebappClassLoader
findClass
FINEST: findClassInternal(org.apache.log4j.spi.LocationInfo)
Jul 2, 2006 9:06:16 PM org.apache.catalina.loader.WebappClassLoader
findClass
FINE: Returning class class org.apache.log4j.spi.LocationInfo
Jul 2, 2006 9:06:16 PM org.apache.catalina.loader.WebappClassLoader
findClass
FINE: Loaded by WebappClassLoader
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@b0ce8f
Jul 2, 2006 9:06:16 PM org.apache.catalina.loader.WebappClassLoader
loadClass
2006-07-02 21:06:15,996 [main] DEBUG tester.SessionTestFilter .init -
C:\My Documents\proj\utils\Web3\build\web\
SessionTestFilter:Initializing filter
FINE: Loading class from local repository
. /**** HERE IS THE HANG!!!!!! **** everything after comes after I kill
the process itself ***/
Jul 2, 2006 9:06:16 PM org.apache.catalina.loader.WebappClassLoader
loadClass
FINE: loadClass(java.io.PrintWriter, false)
Jul 2, 2006 9:06:16 PM org.apache.catalina.loader.WebappClassLoader
loadClass
FINE: loadClass(com.ibm.uvm.tools.DebugSupport, false)
Jul 2, 2006 9:06:16 PM org.apache.catalina.loader.WebappClassLoader
loadClass
FINE: Searching local repositories
Jul 2, 2006 9:06:16 PM org.apache.catalina.loader.WebappClassLoader
findClass
FINE: findClass(com.ibm.uvm.tools.DebugSupport)
// lots after
There is a *lot* more; if you think it is helpful, I can send it.
Wade Chandler wrote:
>--- Avi Deitcher <av...@deitcher.net> wrote:
>
>
>
>>To add to it: I kept two webapps running and had
>>them
>>System.out.println(logger), where each is in the
>>same category/class, to
>>check that each one is running its own; it is. I
>>then removed every
>>webapp I could and ran it again with just the simple
>>filter + index.jsp
>>to check. Same result. Sigh.
>>
>>
>>
>
>Try to setup a file appender and see if you get any
>remotely similar behaviour. If not then my guess
>would be some kind of monitor is locked and code
>either in Tomcat or commons logging or log4j is
>deadlocked. Before setting up the file appender look
>at the process for Tomcat in the windows "Task
>Manager" and see how many CPU cycles it is using at
>this point. If it is eating up the CPU then it isn't
>a deadlock and is some infinite recursive loop (more
>than likely) some where such as your log call keeping
>on calling another log call some how down the stack or
>something weird like that. If the CPU isn't really
>being used at all then my first guess would be a
>deadlock.
>
>Wade
>
>---------------------------------------------------------------------
>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
>
>
>
--
______________________________
Avi Deitcher
avi@deitcher.net
Re: log4j in webapp hanging Tomcat?
Posted by Mark Thomas <ma...@apache.org>.
Avi Deitcher wrote:
> I am not sure how NB grabs the console when it starts it via a
> command-prompt, but whatever it is doing is causing the deadlock. I will
> avoid it for now, but what is the right way to get NB and Tomcat
> together to figure it out?
I'd create a bug against NetBeans in the first instance. If there is
an interaction issue, they will raise a bug against Tomcat, c-l or
log4j as necessary.
Mark
---------------------------------------------------------------------
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 in webapp hanging Tomcat?
Posted by Avi Deitcher <av...@deitcher.net>.
And Wade Chandler definitely wins the prize!
I spent days tracking down, comparing exactly how NetBeans starts it up
vs. how I do it from command prompt, and everything is identical.
However, NetBeans, when it starts, grabs stdout and pipes it to its own
in-memory cache (not sure exactly how). For whatever reason, when log4j
within a webapp (and possibly in the internal Tomcat container itself,
didn't test it enough) writes to a ConsoleAppender, it hangs. If I
switch to a FileAppender, it works beautifully.
I am not sure how NB grabs the console when it starts it via a
command-prompt, but whatever it is doing is causing the deadlock. I will
avoid it for now, but what is the right way to get NB and Tomcat
together to figure it out?
Wade Chandler wrote:
>--- Avi Deitcher <av...@deitcher.net> wrote:
>
>
>
>>To add to it: I kept two webapps running and had
>>them
>>System.out.println(logger), where each is in the
>>same category/class, to
>>check that each one is running its own; it is. I
>>then removed every
>>webapp I could and ran it again with just the simple
>>filter + index.jsp
>>to check. Same result. Sigh.
>>
>>
>>
>
>Try to setup a file appender and see if you get any
>remotely similar behaviour. If not then my guess
>would be some kind of monitor is locked and code
>either in Tomcat or commons logging or log4j is
>deadlocked. Before setting up the file appender look
>at the process for Tomcat in the windows "Task
>Manager" and see how many CPU cycles it is using at
>this point. If it is eating up the CPU then it isn't
>a deadlock and is some infinite recursive loop (more
>than likely) some where such as your log call keeping
>on calling another log call some how down the stack or
>something weird like that. If the CPU isn't really
>being used at all then my first guess would be a
>deadlock.
>
>Wade
>
>---------------------------------------------------------------------
>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
>
>
>
--
______________________________
Avi Deitcher
avi@deitcher.net
Re: log4j in webapp hanging Tomcat?
Posted by Wade Chandler <hw...@yahoo.com>.
--- Avi Deitcher <av...@deitcher.net> wrote:
> To add to it: I kept two webapps running and had
> them
> System.out.println(logger), where each is in the
> same category/class, to
> check that each one is running its own; it is. I
> then removed every
> webapp I could and ran it again with just the simple
> filter + index.jsp
> to check. Same result. Sigh.
>
Try to setup a file appender and see if you get any
remotely similar behaviour. If not then my guess
would be some kind of monitor is locked and code
either in Tomcat or commons logging or log4j is
deadlocked. Before setting up the file appender look
at the process for Tomcat in the windows "Task
Manager" and see how many CPU cycles it is using at
this point. If it is eating up the CPU then it isn't
a deadlock and is some infinite recursive loop (more
than likely) some where such as your log call keeping
on calling another log call some how down the stack or
something weird like that. If the CPU isn't really
being used at all then my first guess would be a
deadlock.
Wade
---------------------------------------------------------------------
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 in webapp hanging Tomcat?
Posted by Avi Deitcher <av...@deitcher.net>.
To add to it: I kept two webapps running and had them
System.out.println(logger), where each is in the same category/class, to
check that each one is running its own; it is. I then removed every
webapp I could and ran it again with just the simple filter + index.jsp
to check. Same result. Sigh.
Avi Deitcher wrote:
>Hello Boris,
>
>Not much luck. I verified that I am running the latest versions of
>commons-logging and log4j. I kept log4j direct in the webapp to avoid
>any chance of commons-logging getting confused, as described in the
>article below. I also removed any reference to log4j or commons-logging
>from shared/ and common/.
>
>I tried something even simpler: a single Web app in its own context with
>*nothing* but a /index.jsp and a single Filter class. No JSF, no
>facelets, no EL, nothing in WEB-INF/lib except for log4j-1.2.13.jar,
>which is the latest.... and it still hangs.
>
>This leaves the unavoidable conclusion that it *must* be some
>interaction between log4j and Tomcat. I can think of nothing else to try
>except following the commons-logging FUD page below, but I am unsure how
>that would impact.
>
>Help? :-(
>
>Boris Unckel wrote:
>
>
>
>>Hello Avi,
>>
>>Avi Deitcher wrote:
>>
>>
>>
>>>Boris,
>>>
>>>Thank you, too. The main issue here is that I *do* want to separate my
>>>webapp's logging from Tomcat's, so it can be fully self-contained.
>>>Hence, I included log4j.jar and log4j.properties within my own webapp,
>>>which should make a lot of sense. In the development case, I am pushing
>>>the logs to the console, which end up intermixes with Tomcat's logs, but
>>>that is an easy switch in log4j.properties. Also, it appears that
>>>x4juli, according to the Website, is not quite ready for production.
>>>
>>>Any idea why this would cause hanging?
>>>Avi
>>>
>>>
>>If there is really a conflict between el and logj4j, try out the
>>following to be sure:
>>Please use the highest available version of log4j and commons-logging:
>>http://logging.apache.org/log4j/docs/download.html
>>http://jakarta.apache.org/site/downloads/downloads_commons-logging.cgi
>>
>>Follow the instructions in
>>http://wiki.apache.org/jakarta-commons/Commons_Logging_FUD
>>to separate container commons-logging and webapps commons-logging.
>>
>>Put log4j.jar in $CATALINA_HOME/server/lib and a log4j.properties in
>>$CATALINA_HOME/server/classes
>>
>>Take care to remove any log4j.jar and commons-logging-xx.jar from
>>$CATALINA_HOME/common/lib
>>or $CATALINA_HOME/shared/lib
>>
>>Take care that commons-logging or log4j is not present at
>>system-classpath due to your startup with Netbeans,
>>this may cause the problem. (Does the problem only occur with startup
>>in Netbeans? Does it occur standalone, too?)
>>
>>Put in logj4.jar in WEB-INF/lib and log4j.properties in
>>WEB-INF/classes as you desired with a webapp specific
>>configuration.
>>
>>Regards
>>Boris
>>
>>
>>---------------------------------------------------------------------
>>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
>>
>>
>>
>
>
>
--
______________________________
Avi Deitcher
avi@deitcher.net
Re: log4j in webapp hanging Tomcat?
Posted by Avi Deitcher <av...@deitcher.net>.
Hello Boris,
Not much luck. I verified that I am running the latest versions of
commons-logging and log4j. I kept log4j direct in the webapp to avoid
any chance of commons-logging getting confused, as described in the
article below. I also removed any reference to log4j or commons-logging
from shared/ and common/.
I tried something even simpler: a single Web app in its own context with
*nothing* but a /index.jsp and a single Filter class. No JSF, no
facelets, no EL, nothing in WEB-INF/lib except for log4j-1.2.13.jar,
which is the latest.... and it still hangs.
This leaves the unavoidable conclusion that it *must* be some
interaction between log4j and Tomcat. I can think of nothing else to try
except following the commons-logging FUD page below, but I am unsure how
that would impact.
Help? :-(
Boris Unckel wrote:
> Hello Avi,
>
> Avi Deitcher wrote:
>
>> Boris,
>>
>> Thank you, too. The main issue here is that I *do* want to separate my
>> webapp's logging from Tomcat's, so it can be fully self-contained.
>> Hence, I included log4j.jar and log4j.properties within my own webapp,
>> which should make a lot of sense. In the development case, I am pushing
>> the logs to the console, which end up intermixes with Tomcat's logs, but
>> that is an easy switch in log4j.properties. Also, it appears that
>> x4juli, according to the Website, is not quite ready for production.
>>
>> Any idea why this would cause hanging?
>> Avi
>
> If there is really a conflict between el and logj4j, try out the
> following to be sure:
> Please use the highest available version of log4j and commons-logging:
> http://logging.apache.org/log4j/docs/download.html
> http://jakarta.apache.org/site/downloads/downloads_commons-logging.cgi
>
> Follow the instructions in
> http://wiki.apache.org/jakarta-commons/Commons_Logging_FUD
> to separate container commons-logging and webapps commons-logging.
>
> Put log4j.jar in $CATALINA_HOME/server/lib and a log4j.properties in
> $CATALINA_HOME/server/classes
>
> Take care to remove any log4j.jar and commons-logging-xx.jar from
> $CATALINA_HOME/common/lib
> or $CATALINA_HOME/shared/lib
>
> Take care that commons-logging or log4j is not present at
> system-classpath due to your startup with Netbeans,
> this may cause the problem. (Does the problem only occur with startup
> in Netbeans? Does it occur standalone, too?)
>
> Put in logj4.jar in WEB-INF/lib and log4j.properties in
> WEB-INF/classes as you desired with a webapp specific
> configuration.
>
> Regards
> Boris
>
>
> ---------------------------------------------------------------------
> 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
>
--
______________________________
Avi Deitcher
avi@deitcher.net
---------------------------------------------------------------------
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 in webapp hanging Tomcat?
Posted by Boris Unckel <bo...@gmx.net>.
Hello Avi,
Avi Deitcher wrote:
> Boris,
>
> Thank you, too. The main issue here is that I *do* want to separate my
> webapp's logging from Tomcat's, so it can be fully self-contained.
> Hence, I included log4j.jar and log4j.properties within my own webapp,
> which should make a lot of sense. In the development case, I am pushing
> the logs to the console, which end up intermixes with Tomcat's logs, but
> that is an easy switch in log4j.properties. Also, it appears that
> x4juli, according to the Website, is not quite ready for production.
>
> Any idea why this would cause hanging?
> Avi
If there is really a conflict between el and logj4j, try out the
following to be sure:
Please use the highest available version of log4j and commons-logging:
http://logging.apache.org/log4j/docs/download.html
http://jakarta.apache.org/site/downloads/downloads_commons-logging.cgi
Follow the instructions in
http://wiki.apache.org/jakarta-commons/Commons_Logging_FUD
to separate container commons-logging and webapps commons-logging.
Put log4j.jar in $CATALINA_HOME/server/lib and a log4j.properties in
$CATALINA_HOME/server/classes
Take care to remove any log4j.jar and commons-logging-xx.jar from
$CATALINA_HOME/common/lib
or $CATALINA_HOME/shared/lib
Take care that commons-logging or log4j is not present at
system-classpath due to your startup with Netbeans,
this may cause the problem. (Does the problem only occur with startup in
Netbeans? Does it occur standalone, too?)
Put in logj4.jar in WEB-INF/lib and log4j.properties in WEB-INF/classes
as you desired with a webapp specific
configuration.
Regards
Boris
---------------------------------------------------------------------
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 in webapp hanging Tomcat?
Posted by Avi Deitcher <av...@deitcher.net>.
Boris,
Thank you, too. The main issue here is that I *do* want to separate my
webapp's logging from Tomcat's, so it can be fully self-contained.
Hence, I included log4j.jar and log4j.properties within my own webapp,
which should make a lot of sense. In the development case, I am pushing
the logs to the console, which end up intermixes with Tomcat's logs, but
that is an easy switch in log4j.properties. Also, it appears that
x4juli, according to the Website, is not quite ready for production.
Any idea why this would cause hanging?
Avi
Boris Unckel wrote:
> Hello Avi,
>
> Avi Deitcher wrote:
>
>> Bob,
>>
>> Thanks. Unfortunately, I am running it on my laptop (Windows) where I
>> need to keep it for now as a dev environment. I run a small consulting
>> business, this is an "on the side" product that need to be run whenever
>> I can catch time.
>>
>> I would love to be able to get Tomcat to tell me what it is doing, but I
>> am afraid that enabling logging in Tomcat itself might pollute the
>> environment and make the problem worse.
>>
>> Ironically, Tomcat has neither log4j nor commons-logging in its
>> $TOMCAT_HOME/common/lib nor server/lib, which makes me wonder how it is
>> using commons-logging in its own classes at all....
>
> by default the internal logging of Tomcat 5.5 is done via
> commons-logging to Tomcat-juli, which
> itself is a java.util.logging implementation.
> If you remove any direct log4j calls from your webapp and configure
> apache-tomcat-5.5.16\conf\logging.properties
> properly, you will use the same system by default.
>
> Have a look at:
> http://tomcat.apache.org/tomcat-5.5-doc/logging.html
> http://tomcat.apache.org/faq/logging.html
> http://jakarta.apache.org/commons/logging/
> http://jakarta.apache.org/commons/logging/commons-logging-1.1/troubleshooting.html
>
> http://wiki.apache.org/jakarta-commons/Logging
>
> Maybe you are interested in a more extended version:
> http://www.x4juli.org
>
> Regards
> Boris
>
> ---------------------------------------------------------------------
> 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
>
--
______________________________
Avi Deitcher
avi@deitcher.net
---------------------------------------------------------------------
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 in webapp hanging Tomcat?
Posted by Boris Unckel <bo...@gmx.net>.
Hello Avi,
Avi Deitcher wrote:
> Bob,
>
> Thanks. Unfortunately, I am running it on my laptop (Windows) where I
> need to keep it for now as a dev environment. I run a small consulting
> business, this is an "on the side" product that need to be run whenever
> I can catch time.
>
> I would love to be able to get Tomcat to tell me what it is doing, but I
> am afraid that enabling logging in Tomcat itself might pollute the
> environment and make the problem worse.
>
> Ironically, Tomcat has neither log4j nor commons-logging in its
> $TOMCAT_HOME/common/lib nor server/lib, which makes me wonder how it is
> using commons-logging in its own classes at all....
by default the internal logging of Tomcat 5.5 is done via
commons-logging to Tomcat-juli, which
itself is a java.util.logging implementation.
If you remove any direct log4j calls from your webapp and configure
apache-tomcat-5.5.16\conf\logging.properties
properly, you will use the same system by default.
Have a look at:
http://tomcat.apache.org/tomcat-5.5-doc/logging.html
http://tomcat.apache.org/faq/logging.html
http://jakarta.apache.org/commons/logging/
http://jakarta.apache.org/commons/logging/commons-logging-1.1/troubleshooting.html
http://wiki.apache.org/jakarta-commons/Logging
Maybe you are interested in a more extended version:
http://www.x4juli.org
Regards
Boris
---------------------------------------------------------------------
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 in webapp hanging Tomcat?
Posted by Avi Deitcher <av...@deitcher.net>.
Bob,
Thanks. Unfortunately, I am running it on my laptop (Windows) where I
need to keep it for now as a dev environment. I run a small consulting
business, this is an "on the side" product that need to be run whenever
I can catch time.
I would love to be able to get Tomcat to tell me what it is doing, but I
am afraid that enabling logging in Tomcat itself might pollute the
environment and make the problem worse.
Ironically, Tomcat has neither log4j nor commons-logging in its
$TOMCAT_HOME/common/lib nor server/lib, which makes me wonder how it is
using commons-logging in its own classes at all....
Bob Hall wrote:
>--- Avi Deitcher <av...@deitcher.net> wrote:
>
>
>
>>The simple classes (a JSF backing bean and a filter)
>>are set to use
>>either commons-logging or log4j directly (I tried
>>both). In either case,
>>the moment that I uncomment any category line and
>>one of my classes (the
>>filter or the bean) calls log.debug("some message"),
>>Tomcat freezes
>>entirely. This is true whether I use log4j directly
>>or commons-logging
>>in my classes, and whether or not I comment or
>>uncomment the first
>>log4j.rootCategory line in log4j.properties. I get
>>some output from the
>>appender matching the pattern, and then freeze. I
>>cannot access any
>>context; I cannot use the manager; the only thing I
>>can do is kill the
>>Tomcat process.
>>
>>I am at wit's end with this; it took literally days
>>to narrow down that
>>it was log4j's activation doing it.
>>
>>
>>
>
>Avi,
>
>You didn't mention which OS you are using. If
>it's *nix you may be able use 'truss' to get info
>on exactly what Tomcat is doing when it "freezes".
>BTW, a google search produced several hits for
>linux impl's of solaris' truss command. My
>guess is that you'll find that Tomcat is stuck
>in a "loop".
>
>HTH,
>Bob
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam? Yahoo! Mail has the best spam protection around
>http://mail.yahoo.com
>
>---------------------------------------------------------------------
>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
>
>
>
--
______________________________
Avi Deitcher
avi@deitcher.net
Re: log4j in webapp hanging Tomcat?
Posted by Bob Hall <rf...@yahoo.com>.
--- Bob Hall <rf...@yahoo.com> wrote:
> --- Avi Deitcher <av...@deitcher.net> wrote:
>
> > The simple classes (a JSF backing bean and a
> filter)
> > are set to use
> > either commons-logging or log4j directly (I tried
> > both). In either case,
> > the moment that I uncomment any category line and
> > one of my classes (the
> > filter or the bean) calls log.debug("some
> message"),
> > Tomcat freezes
> > entirely. This is true whether I use log4j
> directly
> > or commons-logging
> > in my classes, and whether or not I comment or
> > uncomment the first
> > log4j.rootCategory line in log4j.properties. I get
> > some output from the
> > appender matching the pattern, and then freeze. I
> > cannot access any
> > context; I cannot use the manager; the only thing
> I
> > can do is kill the
> > Tomcat process.
> >
> > I am at wit's end with this; it took literally
> days
> > to narrow down that
> > it was log4j's activation doing it.
> >
>
> Avi,
>
> You didn't mention which OS you are using. If
> it's *nix you may be able use 'truss' to get info
> on exactly what Tomcat is doing when it "freezes".
> BTW, a google search produced several hits for
> linux impl's of solaris' truss command. My
> guess is that you'll find that Tomcat is stuck
> in a "loop".
>
> HTH,
> Bob
>
Looks link linux's equivalent of 'truss' is 'strace'.
-Bob
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
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 in webapp hanging Tomcat?
Posted by Bob Hall <rf...@yahoo.com>.
--- Avi Deitcher <av...@deitcher.net> wrote:
> The simple classes (a JSF backing bean and a filter)
> are set to use
> either commons-logging or log4j directly (I tried
> both). In either case,
> the moment that I uncomment any category line and
> one of my classes (the
> filter or the bean) calls log.debug("some message"),
> Tomcat freezes
> entirely. This is true whether I use log4j directly
> or commons-logging
> in my classes, and whether or not I comment or
> uncomment the first
> log4j.rootCategory line in log4j.properties. I get
> some output from the
> appender matching the pattern, and then freeze. I
> cannot access any
> context; I cannot use the manager; the only thing I
> can do is kill the
> Tomcat process.
>
> I am at wit's end with this; it took literally days
> to narrow down that
> it was log4j's activation doing it.
>
Avi,
You didn't mention which OS you are using. If
it's *nix you may be able use 'truss' to get info
on exactly what Tomcat is doing when it "freezes".
BTW, a google search produced several hits for
linux impl's of solaris' truss command. My
guess is that you'll find that Tomcat is stuck
in a "loop".
HTH,
Bob
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
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