[slf4j-user] Serializable log adapters
Trustin Lee
trustin at gmail.com
Tue Mar 13 09:36:44 CET 2007
On 3/13/07, Christian Stein <sormuras at gmx.net> wrote:
>
> Trustin Lee schrieb:
> > On 3/13/07, *Ceki Gülcü* <listid at qos.ch <mailto:listid at qos.ch>> wrote:
> >
> > At 02:09 PM 3/12/2007, Holger Hoffstaette wrote:
> > >On Sun, 11 Mar 2007 22:29:03 +0000, Jeremy Booth wrote:
> > >
> > > > Is there a reason why the adapters don't implement serializable
> > other than
> > > > a lack of demand? Would it be possible to make them
> > serializable so I can
> > > > switch?, looking at the javadocs I assume it would be the
> > logger adapter
> > > > implementations, org.slf4j.spi.LocationAwareLogger and
> > org.slf4j.Logger
> > > > that would need the change.
> > >
> > >I don't think this is either necessary or desirable. If your
> > classes are
> > >Serializable, make the loggers transient and override
> readResolve() to
> > >recreate/set the log instance. Cuts down on useless serialization
> > overhead
> > >too!
> >
> > Sounds pretty reasonable to me. Jeremy, would Holger's suggestion
> above
> > work for you?
> >
> >
> > Implementing readResolve() for every class with a logger field is
> > painful. Would there be any easier way? Of course, the easiest
> > solution is not to use logger for serializable objects, which might make
> > sense.
>
> Or use the static logger per class approach.
> Although, not recommended [1], it could solve the resurrection problems.
> Or is static a no-go in your scenario?
It's OK in my scenario, but I just wanted to say that it's very cumbersome
if there's such a scenario.
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/slf4j-user/attachments/20070313/2debf102/attachment.htm>
More information about the slf4j-user
mailing list