Re: [jgroups-dev] Logging and Inheritance

Galder Zamarreño <[email protected]>
Newsgroups gmane.comp.java.javagroups.devel
Message-ID <[email protected]>
I prefer this as well, it makes it easier to track where the origin of the log message is.

On Oct 6, 2010, at 1:38 PM, Amin Abbaspour wrote:

> Hi all,
> 
> I believe it's better to define logger in each class rather than using inheritance, i.e.:
> 
> private static final Log log = LogFactory.getLog(MyClassName.class);
> 
> It's like this in right now (see Protocol.java):
> 
> protected final Log log=LogFactory.getLog(this.getClass());
> 
> This adds a small bit of code but prevent incorrect line numbers in log. 
> 
> With current model one may see a message in UDP:896 while logger class is UDP and line number belongs to TP.java.
> 
> Of course this means that every log call in TP results in logging via TP logger not the inherited one, which is bearable IMHO. 
> 
> Regards,
> Amin
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> Javagroups-development mailing list
> 

--
Galder Zamarreño
Sr. Software Engineer
Infinispan, JBoss Cache


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Javagroups-development mailing list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.