See PatternLayout javadoc [1].  In any case, I think getLogger(Class) just 
creates
confusion.  It was added as a convenience because of the way most people name
their loggers, using the package/class hierarchy.  But really a logger name is
just a string and getLogger(String) would have been sufficient (using
getClass().getName()) and less confusing as it would have made clear to users 
that
package/class is only one approach to naming loggers, not the only one.


[1] 
http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html


Jake

On 9/4/2011 2:53 AM, Antonio Rodriges wrote:
> Hello,
> 
> In multithreaded applications I got messages like
> 
> 2011-09-04/01:50:22.515/PDT [AwtEventQueue-1] INFO  Received: message
> 
> Thus,
>  private final Logger LOG = Logger.getLogger(this.getClass());
> 
> "this.getClass()" does not really make sense?
> 
> How to enable log4j more specific what class makes the message in
> multithreaded applications?
> Also, is there any way to log automatically the name of a method?
> 
> Thank you
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 
> 
> 
> 

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

Reply via email to