Class NamedLoggerBase

  • All Implemented Interfaces:
    java.io.Serializable, Logger
    Direct Known Subclasses:
    MarkerIgnoringBase

    abstract class NamedLoggerBase
    extends java.lang.Object
    implements Logger, java.io.Serializable
    Serves as base class for named logger implementation. More significantly, this class establishes deserialization behavior.
    Since:
    1.5.3
    See Also:
    readResolve()
    • Field Detail

      • name

        protected java.lang.String name
    • Constructor Detail

      • NamedLoggerBase

        NamedLoggerBase()
    • Method Detail

      • getName

        public java.lang.String getName()
        Description copied from interface: Logger
        Return the name of this Logger instance.
        Specified by:
        getName in interface Logger
        Returns:
        name of this logger instance
      • readResolve

        protected java.lang.Object readResolve()
                                        throws java.io.ObjectStreamException
        Replace this instance with a homonymous (same name) logger returned by LoggerFactory. Note that this method is only called during deserialization.

        This approach will work well if the desired ILoggerFactory is the one references by LoggerFactory. However, if the user manages its logger hierarchy through a different (non-static) mechanism, e.g. dependency injection, then this approach would be mostly counterproductive.

        Returns:
        logger with same name as returned by LoggerFactory
        Throws:
        java.io.ObjectStreamException