Class NamedLoggerBase

java.lang.Object
org.slf4j.helpers.NamedLoggerBase
All Implemented Interfaces:
Serializable, Logger
Direct Known Subclasses:
MarkerIgnoringBase

abstract class NamedLoggerBase extends Object implements Logger, Serializable
Serves as base class for named logger implementation. More significantly, this class establishes deserialization behavior.
Since:
1.5.3
See Also:
  • Field Details

  • Constructor Details

    • NamedLoggerBase

      NamedLoggerBase()
  • Method Details

    • getName

      public 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 Object readResolve() throws 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:
      ObjectStreamException