You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Andy Rozman <an...@triera.net> on 2009/04/14 23:01:19 UTC

logging from another class

Hi !

I already asked this question once, but there were no answers then, I 
hope there will be one now... I have several classes which need to use 
logger. Theretically I could instantiate it in each class, but problem 
is that this message must also be used in some other module (log must be 
displayed in my swing applciation). So I wanted to create Util class 
which will a) write into log b) send info to swing application. Problem 
is that when I do that, I get that log message was created in this Util 
class. I need to know name and line of class that called this Util 
class, how could this be done? Is there possibility to do that?

Take care,
Andy

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


Re: logging from another class

Posted by Jacob Kjome <ho...@visi.com>.
You need to call logger.log() and pass in the fully qualified name of the Util 
class with a "." appended to it.

Jake


On Tue, 14 Apr 2009 23:01:19 +0200
  Andy Rozman <an...@triera.net> wrote:
> Hi !
> 
> I already asked this question once, but there were no answers then, I hope 
>there will be one now... I have several classes which need to use logger. 
>Theretically I could instantiate it in each class, but problem is that this 
>message must also be used in some other module (log must be displayed in my 
>swing applciation). So I wanted to create Util class which will a) write into 
>log b) send info to swing application. Problem is that when I do that, I get 
>that log message was created in this Util class. I need to know name and line 
>of class that called this Util class, how could this be done? Is there 
>possibility to do that?
> 
> Take care,
> Andy
> 
> ---------------------------------------------------------------------
> 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