logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Watts <...@cliftonfarm.org>
Subject Re: Log messages in multithreaded applications
Date Sun, 04 Sep 2011 15:34:04 GMT
See:

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

you want the %c specifier in your log4j configuration for the layout.

If each of the classes that will be logging has (or inherits) an
initializer like the one you mentioned then "this.getClass()" actually
does make sense. Although being private, of course, means it will be
inaccessible to subclasses.


On Sun, 2011-09-04 at 01:53 -0700, 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-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 



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


Mime
View raw message