Class CommonsLoggerFactory


  • public class CommonsLoggerFactory
    extends LoggerFactory<Log>
    A factory for loggers that redirect all Java logging events to the Apache's Commons-logging framework.

    Out of the box commons logging delegates to the java util logging framework (using the class org.apache.commons.logging.impl.Jdk14Logger). If this factory detects Commons logging is already delegating to Jdk14Logger it will return null allowing java util logging directly.

    Since:
    2.4
    Author:
    Martin Desruisseaux
    • Constructor Detail

      • CommonsLoggerFactory

        protected CommonsLoggerFactory()
                                throws NoClassDefFoundError
        Constructs a default factory.
        Throws:
        NoClassDefFoundError - if Apache's Log class was not found on the classpath.
    • Method Detail

      • getInstance

        public static CommonsLoggerFactory getInstance()
                                                throws NoClassDefFoundError
        Returns the unique instance of this factory.
        Throws:
        NoClassDefFoundError - if Apache's Log class was not found on the classpath.
      • getImplementation

        protected Log 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<Log>
        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 Log unwrap​(Logger logger)
        Returns the implementation wrapped by the specified logger, or null if none.
        Specified by:
        unwrap in class LoggerFactory<Log>
        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<Log>
        Returns:
        configuration information, or null unknown.