struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mohan Radhakrishnan <Moh...@hclcomnet.co.in>
Subject RE: Best Practices for Logging?
Date Sat, 07 Dec 2002 13:20:58 GMT
Hi,
    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
from
 LoginUsers where username='ge' and password='ge'

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

Thanks,
Mohan

-----Original Message-----
From: Eddie Bush [mailto:ekbush@swbell.net]
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 [mailto:matt@raibledesigns.com] 
>>Sent: Friday, December 06, 2002 1:34 PM
>>To: struts-user@jakarta.apache.org
>>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("my.package.name");
>>
>>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
object
>
>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 
basis.

>>Thanks,
>>
>>Matt
>>    
>>
>Sri
>

-- 
Eddie Bush





--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message