struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mohan Radhakrishnan <>
Subject RE: Best Practices for Logging?
Date Sat, 07 Dec 2002 13:20:58 GMT
    Doesn't the log for web applications show only the thread number instead
of the class name that logged the message?

Like this.

07 Dec 2002 19:03:04,622 DEBUG [Thread-4] (?:?) - select username, password
 LoginUsers where username='ge' and password='ge'

  Is this the right behavior? Doesn't help much.


-----Original Message-----
From: Eddie Bush []
Sent: Saturday, December 07, 2002 2:08 AM
To: Struts Users Mailing List
Subject: Re: Best Practices for Logging?

Sri Sankaran wrote:

>>-----Original Message-----
>>From: Matt Raible [] 
>>Sent: Friday, December 06, 2002 1:34 PM
>>Subject: Best Practices for Logging?
>>I'm wondering what is considered the best practice for logging using 
>>commons-logging in a Struts app.  My current approach is to 
>>have a Base 
>>class in every package that has the following:
>>protected Log log =
>>         LogFactory.getLog("");
>>But I've noticed that some of the Struts examples have an instance of 
>>this in every class.  
>Personally I prefer the class level.  This provides you with a finer grain
of control.  However, I restrict it to only one per class and not one per
>public class Foo {
>  private static Log log = LogFactory.getLog(Foo.class);
>  ..
General consensus seems to be that this is the "best practice" approach. 
 You wind up with more loggers, but they give you very fine-grained 
control as Sri mentioned.  You can still set a log-level for a package, 
but you then also have the ability to manipulate the log-level on a per 
class basis too - so you can relaly "zoom-in" on things.

>>Is this recommended, so that logging 
>>can be done 
>>on a class level, as well as a package level?  Any thoughts/opinions 
>>are appreciated.
It should be a static member as per what Sri shows (so you only have one 
per class).  Yes - it's so you can control logging on a package/class 


Eddie Bush

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message