Class Logger

All Implemented Interfaces:
Serializable, Logger, ExtendedLogger, LocationAwareLogger, Supplier<LoggerConfig>
Direct Known Subclasses:
AsyncLogger

public class Logger extends AbstractLogger implements Supplier<LoggerConfig>
The core implementation of the Logger interface. Besides providing an implementation of all the Logger methods, this class also provides some convenience methods for Log4j 1.x compatibility as well as access to the Filters and Appenders associated with this Logger. Note that access to these underlying objects is provided primarily for use in unit tests or bridging legacy Log4j 1.x code. Future versions of this class may or may not include the various methods that are noted as not being part of the public API. TODO All the isEnabled methods could be pushed into a filter interface. Not sure of the utility of having isEnabled be able to examine the message pattern and parameters. (RG) Moving the isEnabled methods out of Logger noticeably impacts performance. The message pattern and parameters are required so that they can be used in global filters.
See Also:
  • Field Details

    • privateConfig

      protected volatile Logger.PrivateConfig privateConfig
      Config should be consistent across threads.
  • Constructor Details

    • Logger

      protected Logger(LoggerContext context, String name, MessageFactory messageFactory)
      The constructor.
      Parameters:
      context - The LoggerContext this Logger is associated with.
      messageFactory - The message factory.
      name - The name of the Logger.
  • Method Details