Class LogbackLoggerFactory


  • public class LogbackLoggerFactory
    extends LoggerFactory<Logger>
    A factory for loggers that redirect all Java logging events to logback framework (using the sl4j API).

    The sl4j api is used to all interactions excepting LogbackLogger.setLevel(Level) (which is primarily used during test cases).

    Since:
    27
    Author:
    Jody Garnett (GeoCat)
    • Constructor Detail

      • LogbackLoggerFactory

        protected LogbackLoggerFactory()
                                throws NoClassDefFoundError
        Constructs a default factory.
        Throws:
        NoClassDefFoundError - if sl4j's org.slf4j.Logger class was not found on the classpath.
    • Method Detail

      • getInstance

        public static LogbackLoggerFactory getInstance()
                                                throws NoClassDefFoundError
        Returns the unique instance of this factory.
        Throws:
        NoClassDefFoundError - if sl4j's org.slf4j.Logger class was not found on the classpath.
      • getImplementation

        protected Logger getImplementation​(String name)
        Returns the implementation to use for the logger of the specified name, or null if the logger would delegate to Java logging anyway.
        Specified by:
        getImplementation in class LoggerFactory<Logger>
        Parameters:
        name - The name of the logger.
        Returns:
        The logger as an object of the target logging framework (Log4J, SLF4J, etc.), or null if the target framework would redirect to the Java logging framework.
      • unwrap

        protected Logger unwrap​(Logger logger)
        Returns the implementation wrapped by the specified logger, or null if none.
        Specified by:
        unwrap in class LoggerFactory<Logger>
        Parameters:
        logger - The logger to test.
        Returns:
        The implementation wrapped by the specified logger, or null if none.
      • lookupConfiguration

        public String lookupConfiguration()
        Description copied from class: LoggerFactory
        Look up configuration information, or null unknown.

        Report back details on how logging configuration is setup. Ideally including configuration filename along with any system properties used.

        Overrides:
        lookupConfiguration in class LoggerFactory<Logger>
        Returns:
        configuration information, or null unknown.