Most people use a static field to store the Logger, so most use cases don't require serialization. For instance fields, it might work better to declare it transient, and in that case, our implementation of Logger should not be Serializable at all. Otherwise, there are ways to serialize everything, but the way it looks, that will require making over 50% of the code base Serializable which doesn't smell right to me.
On 14 October 2015 at 16:54, Gary Gregory <[email protected]> wrote: > It would be a neat trick to only use the logger name for ser/deser. But a > logger only exists in a LC, so how would you re-create the Logger object. > LogManager.getLogger(String) can't account for the message factory for > example. Would knowing the class within which the static Logger resides be > enough to know which LC to use? I do not see how :-( I think we need > Ralph's insight here. > > The alternative would be... to recommend that all Logger declarations be > transient? That does not seen realistic, especially accounting for code you > cannot change. > > Gary > > On Wed, Oct 14, 2015 at 2:48 PM, Matt Sicker <[email protected]> wrote: > >> Perhaps besides a particular LoggerContext. I have an idea on how to >> significantly simplify the serialization of Logger, and if we can simply >> unserialize it based purely on its name, then that would save a lot of >> trouble. I don't remember if we've discussed this idea in the past, but I >> think this would be the best way to implement serialization in Logger. I >> wouldn't want to pass a Logger over the wire and clobber a possibly >> different configuration already in memory at the time, for instance. >> >> -- >> Matt Sicker <[email protected]> >> > > > > -- > E-Mail: [email protected] | [email protected] > Java Persistence with Hibernate, Second Edition > <http://www.manning.com/bauer3/> > JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> > Spring Batch in Action <http://www.manning.com/templier/> > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory > -- Matt Sicker <[email protected]>
