Interface LoggerProvider


public interface LoggerProvider
Defines the interface for a factory class to provide Logger instances for each Source object.

It is not usually necessary for users to create implementations of this interface, as several predefined instances are defined which provide the most commonly required Logger implementations.

By default, a LoggerProvider is chosen automatically according to the algorithm described in the static Config.LoggerProvider property. This automatic choice can be overridden by setting the Config.LoggerProvider property manually with an instance of this interface, but this is also usually not necessary.

  • Field Details

  • Method Details

    • getLogger

      Logger getLogger(String name)
      Creates a new Logger instance with the specified name.

      The name argument is used by the underlying logging implementation, and is normally a dot-separated name based on the package name or class name of the subsystem.

      The getSourceLogger() method is used internally instead of this method to avoid creating a new logger instance for every Source instance, which would result in a bottleneck in highly concurrent applications.

      Parameters:
      name - the name of the logger, the use of which is determined by the underlying logging implementation, may be null.
      Returns:
      a new Logger instance with the specified name.
    • getSourceLogger

      Logger getSourceLogger()
      Gets a shared, permanently cached Logger instance used by all Source instances.

      The name of the returned Logger instance is "net.htmlparser.jericho".

      The shared instance is created lazily and permanently cached by the relevant logging provider.

      Returns:
      a shared, permanently cached Logger instance used by all Source instances.