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 Anna Battenhouse <an...@cci-triad.com> on 2003/04/03 02:03:36 UTC
is Logger serializable?
Hello -
I am a brand new log4j user so this is probably a stupid question, but is a
Logger meant to be serializable? Or should I mark Logger instance variables
in my serializable bean classes as transient? The Serializable interface
isn't on Logger.
Thanks,
------------------------------------------------------
Anna Battenhouse
Internet Applications Architect
CCITRIAD, Inc.
804 Las Cimas Parkway, Suite 200
Austin TX 78746
(512) 278-5524
anna.battenhouse@ccitriad.com
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
Re: is Logger serializable?
Posted by Erik Price <ep...@ptc.com>.
Jacob Kjome wrote:
>
> If you make them class static variables, it is the same as marking them
> as transient. The recommended way to define a logger is probably....
>
> private static final Logger logger =
> Logger.getLogger(MyClass.class.getName());
Is making it 'final' a performance-related suggestion (i.e., does the
compiler optimize anything if you do this), or practice-related (no
reason to point the var at a new object)?
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
Re: is Logger serializable?
Posted by Jacob Kjome <ho...@visi.com>.
If you make them class static variables, it is the same as marking them as
transient. The recommended way to define a logger is probably....
private static final Logger logger = Logger.getLogger(MyClass.class.getName());
This will not be serialized. If you don't make it static, then do...
private transient final Logger logger =
Logger.getLogger(DBRApplicationGateway.class.getName());
Jake
At 06:03 PM 4/2/2003 -0600, you wrote:
>Hello -
>
>I am a brand new log4j user so this is probably a stupid question, but is a
>Logger meant to be serializable? Or should I mark Logger instance variables
>in my serializable bean classes as transient? The Serializable interface
>isn't on Logger.
>
>Thanks,
>------------------------------------------------------
>Anna Battenhouse
>Internet Applications Architect
>CCITRIAD, Inc.
>804 Las Cimas Parkway, Suite 200
>Austin TX 78746
>(512) 278-5524
>anna.battenhouse@ccitriad.com
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org