[weld-dev] Loggers aren't serializable?

Arbi Sookazian asookazian at gmail.com
Fri Dec 11 12:11:27 EST 2009


"The SLF4JLog and SLF4JLocationAwareLog classes are now serializable solving
serialization problems encountered with certain libraries which attempt to
serialize JCL log instances."

www.*slf4j*.*org*/news.html

So why doesn't org.slf4j.Logger extend java.io.Serializable?

public class *SLF4JLog*extends Object
<http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true>implements
Log <http://www.slf4j.org/apidocs/org/apache/commons/logging/Log.html>,
Serializable <http://java.sun.com/j2se/1.5.0/docs/api/java/io/Serializable.html?is-external=true>

 Implementation of
org.apache.commons.logging.Log<http://www.slf4j.org/apidocs/org/apache/commons/logging/Log.html>interface
which delegates all processing to a wrapped
org.slf4j.Logger <http://www.slf4j.org/apidocs/org/slf4j/Logger.html>instance.

Apparently log4j loggers are not Serializable either:
http://stackoverflow.com/questions/82109/should-a-log4j-logger-be-declared-as-transient

On Fri, Dec 11, 2009 at 8:45 AM, Gavin King <gavin.king at gmail.com> wrote:

> Right, it's definitely not OK if injected loggers just disappear after
> passivation.
>
> On Fri, Dec 11, 2009 at 11:37 AM, Dan Allen <dan.j.allen at gmail.com> wrote:
> > In this case, is the transient keyword not sufficient? I guess the
> problem
> > is injection won't happen again after the object is deserialized.
> >
> > Why does it always come down to loggers. Loggers are just killing Java.
> So I
> > agree, it is rather embarrassing.
> >
> > -Dan
> >
> > On Fri, Dec 11, 2009 at 11:27 AM, Gavin King <gavin.king at gmail.com>
> wrote:
> >>
> >> This is kind-of embarrassing:
> >>
> >> http://www.seamframework.org/Community/InjectLoggerFromSlf4j
> >>
> >> We really *do* need static injection points....
> >>
> >> --
> >> Gavin King
> >> gavin.king at gmail.com
> >> http://in.relation.to/Bloggers/Gavin
> >> http://hibernate.org
> >> http://seamframework.org
> >> _______________________________________________
> >> weld-dev mailing list
> >> weld-dev at lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/weld-dev
> >
> >
> >
> > --
> > Dan Allen
> > Senior Software Engineer, Red Hat | Author of Seam in Action
> > Registered Linux User #231597
> >
> > http://mojavelinux.com
> > http://mojavelinux.com/seaminaction
> > http://www.google.com/profiles/dan.j.allen
> >
>
>
>
> --
> Gavin King
> gavin.king at gmail.com
> http://in.relation.to/Bloggers/Gavin
> http://hibernate.org
> http://seamframework.org
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20091211/5b84163a/attachment.html 


More information about the weld-dev mailing list