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 cl...@airmail.net on 2004/10/18 15:05:49 UTC
Question about getLogger() references
I have a question about the references returned via the getLogger method
that I hope someone can answer easily. Assuming that multiple calls were
made to the Logger.getLogger() method(with the same parm), would they all
return exactly the same reference? ie...
When the call:
private static final Logger log1=Logger.getLogger( "sameclass.class" );
is made, and for some reason another call is made for a temporary logger
at some later point in the program execution:
private Logger log2=Logger.getLogger( "sameclass.class" );
Would the following ALWAYS be true? log1 == log2 (reference
compare...not using the .equals() method)
Thanks,
Doug Clifton
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Question about getLogger() references
Posted by cl...@airmail.net.
Thanks Ceki, I figured it was a mixed answer. Appreciate the info.
>
> In general, log1==log2 where log1 and log2 are defined as
>
> Logger log1=Logger.getLogger( "x" );
> Logger log2=Logger.getLogger( "x" );
>
> However, if you are using a special repository selector under the surface,
> then log1 may be different from log2.
>
>
> At 03:05 PM 10/18/2004, you wrote:
>>I have a question about the references returned via the getLogger method
>>that I hope someone can answer easily. Assuming that multiple calls were
>>made to the Logger.getLogger() method(with the same parm), would they all
>>return exactly the same reference? ie...
>>
>>When the call:
>>
>>private static final Logger log1=Logger.getLogger( "sameclass.class" );
>>
>>is made, and for some reason another call is made for a temporary logger
>>at some later point in the program execution:
>>
>>private Logger log2=Logger.getLogger( "sameclass.class" );
>>
>>Would the following ALWAYS be true? log1 == log2 (reference
>>compare...not using the .equals() method)
>>
>>Thanks,
>> Doug Clifton
>
> --
> Ceki Gülcü
>
> For log4j documentation consider "The complete log4j manual"
> ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
>
>
>
> ---------------------------------------------------------------------
> 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
Re: Question about getLogger() references
Posted by Ceki Gülcü <ce...@qos.ch>.
In general, log1==log2 where log1 and log2 are defined as
Logger log1=Logger.getLogger( "x" );
Logger log2=Logger.getLogger( "x" );
However, if you are using a special repository selector under the surface,
then log1 may be different from log2.
At 03:05 PM 10/18/2004, you wrote:
>I have a question about the references returned via the getLogger method
>that I hope someone can answer easily. Assuming that multiple calls were
>made to the Logger.getLogger() method(with the same parm), would they all
>return exactly the same reference? ie...
>
>When the call:
>
>private static final Logger log1=Logger.getLogger( "sameclass.class" );
>
>is made, and for some reason another call is made for a temporary logger
>at some later point in the program execution:
>
>private Logger log2=Logger.getLogger( "sameclass.class" );
>
>Would the following ALWAYS be true? log1 == log2 (reference
>compare...not using the .equals() method)
>
>Thanks,
> Doug Clifton
--
Ceki Gülcü
For log4j documentation consider "The complete log4j manual"
ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org