You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Ha...@alcatel.com.au on 2005/12/29 22:39:39 UTC

Re: Tomcat log4j logging

Hi Jacob,

Thank you for the information.

Actually, my logging works most of the time.  I think  it is not working 
for the
deep level calls stack. 

More preceisly, 

Let say  following is the call stack  structure

a.ma() ->  b.mb()    ->  c.mc() ->  d.md() ->e.me();


I can  see the logs from  ma(), mb(), mc() and md() but not in  me(). 
I  know that me() is executed because otherwise my application  wouldn't
 work. It is just I can't see logs after certain level. Is there such 
setting in log4j ?


Thank you very much.

Hakan

 





Jacob Kjome <ho...@visi.com> 
30/12/2005 03:07 AM
Please respond to
"Log4J Users List" <lo...@logging.apache.org>


To
"Log4J Users List" <lo...@logging.apache.org>
cc

Subject
Re: Tomcat  log4j logging






At 01:48 PM 12/29/2005 +1100, you wrote:
 >
 >Hi everyone,
 >
 >I am using  log4j under Tomcat  5.0  with log4j.properties file.
 >When I  perform unit test outside of Tomcat I can see   log from
 >some  deep  level  of call stack. However, it isn't the case when
 >I use  the same components  inside Tomcat. It looks like Tomcat
 >filters out  the logs coming from the deep level of call stack.
 >I  ran Tomcat in console mode to see the  standard output from
 >that deep level calls.  I cannot see the standard output  calls ( only
 >the deep level calls ) either.
 >
 >Is there a way to  change this behaviour ?
 >

Do you have log4j.jar in WEB-INF/lib?  If not, do that.  Also, are there 
any cases of a log4j.xml in the classpath (default package, maybe hidden 
inside a jar, in the app or server)?  Log4j's default initialization (in a 

static block of LogManager) loads log4j.xml in preference to 
log4j.properties.  It is possible that you are picking up some other 
configuration, which might explain why you don't see the logging you 
expect.  Of course, if you don't have log4j.jar in WEB-INF/lib, then you 
are almost certainly not using the configuration you expect because log4j 
would have already been configured at the server level (if log4j.jar 
exists 
there, which it must if you didn't include it in WEB-INF/lib).

Anyway, try those suggestions out and see if it solves your problem.  I 
suggest you simply move to an XML config file, both to guarantee that you 
pick of the configuration that you expect and to gain some extra 
configuration possibilities because there is some stuff that isn't 
supported by properties files that is supported by XML config files.

Jake

 >
 >Thanks
 >
 >
 >Hakan
 >
 >
 >This email may contain privileged/confidential information. You may not 
copy
 >or disclose this email to anyone without the written permission of the
 >sender.  If you have received this email in error please kindly delete 
this
 >message and notify the sender.  Opinions expressed in this email are 
those
 >of the sender and not necessarily the opinions of the employer.
 >
 >This email and any attached files should be scanned to detect viruses. 
No
 >liability will be accepted by the employer for loss or damage (whether
 >caused by negligence or not) as a result of email transmission.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org




This email may contain privileged/confidential information. You may not copy or disclose this email to anyone without the written permission of the sender.  If you have received this email in error please kindly delete this message and notify the sender.  Opinions expressed in this email are those of the sender and not necessarily the opinions of the employer. 

This email and any attached files should be scanned to detect viruses.  No liability will be accepted by the employer for loss or damage (whether caused by negligence or not) as a result of email transmission.

RE: Tomcat log4j logging

Posted by Burton Strauss <Bu...@SmallNetSolutions.com>.
Check your class loaders.  I posted on this a couple weeks back ...
http://comments.gmane.org/gmane.comp.jakarta.log4j.user/12263

If you end up with different class loader branches, even a singleton pattern
will end up with separate instances.  This can mean that they read different
configuration files and poof ... Disappearing log messages.

-----Burton
 

-----Original Message-----
From: Hakan.Barisik@alcatel.com.au [mailto:Hakan.Barisik@alcatel.com.au] 
Sent: Thursday, December 29, 2005 3:40 PM
To: Log4J Users List
Subject: Re: Tomcat log4j logging


Hi Jacob,

Thank you for the information.

Actually, my logging works most of the time.  I think  it is not working for
the deep level calls stack. 

More preceisly, 

Let say  following is the call stack  structure

a.ma() ->  b.mb()    ->  c.mc() ->  d.md() ->e.me();


I can  see the logs from  ma(), mb(), mc() and md() but not in  me(). 
I  know that me() is executed because otherwise my application  wouldn't
work. It is just I can't see logs after certain level. Is there such setting
in log4j ?


Thank you very much.

Hakan

 





Jacob Kjome <ho...@visi.com> 
30/12/2005 03:07 AM
Please respond to
"Log4J Users List" <lo...@logging.apache.org>


To
"Log4J Users List" <lo...@logging.apache.org>
cc

Subject
Re: Tomcat  log4j logging






At 01:48 PM 12/29/2005 +1100, you wrote:
 >
 >Hi everyone,
 >
 >I am using  log4j under Tomcat  5.0  with log4j.properties file.
 >When I  perform unit test outside of Tomcat I can see   log from
 >some  deep  level  of call stack. However, it isn't the case when
 >I use  the same components  inside Tomcat. It looks like Tomcat
 >filters out  the logs coming from the deep level of call stack.
 >I  ran Tomcat in console mode to see the  standard output from
 >that deep level calls.  I cannot see the standard output  calls ( only
 >the deep level calls ) either.
 >
 >Is there a way to  change this behaviour ?
 >

Do you have log4j.jar in WEB-INF/lib?  If not, do that.  Also, are there 
any cases of a log4j.xml in the classpath (default package, maybe hidden 
inside a jar, in the app or server)?  Log4j's default initialization (in a 

static block of LogManager) loads log4j.xml in preference to 
log4j.properties.  It is possible that you are picking up some other 
configuration, which might explain why you don't see the logging you 
expect.  Of course, if you don't have log4j.jar in WEB-INF/lib, then you 
are almost certainly not using the configuration you expect because log4j 
would have already been configured at the server level (if log4j.jar 
exists 
there, which it must if you didn't include it in WEB-INF/lib).

Anyway, try those suggestions out and see if it solves your problem.  I 
suggest you simply move to an XML config file, both to guarantee that you 
pick of the configuration that you expect and to gain some extra 
configuration possibilities because there is some stuff that isn't 
supported by properties files that is supported by XML config files.

Jake

 >
 >Thanks
 >
 >
 >Hakan
 >
 >
 >This email may contain privileged/confidential information. You may not 
copy
 >or disclose this email to anyone without the written permission of the
 >sender.  If you have received this email in error please kindly delete 
this
 >message and notify the sender.  Opinions expressed in this email are 
those
 >of the sender and not necessarily the opinions of the employer.
 >
 >This email and any attached files should be scanned to detect viruses. 
No
 >liability will be accepted by the employer for loss or damage (whether
 >caused by negligence or not) as a result of email transmission.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org




This email may contain privileged/confidential information. You may not copy
or disclose this email to anyone without the written permission of the
sender.  If you have received this email in error please kindly delete this
message and notify the sender.  Opinions expressed in this email are those
of the sender and not necessarily the opinions of the employer. 

This email and any attached files should be scanned to detect viruses.  No
liability will be accepted by the employer for loss or damage (whether
caused by negligence or not) as a result of email transmission.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org