Class Log4J2LoggerFactory


  • public class Log4J2LoggerFactory
    extends LoggerFactory<Logger>
    A factory for loggers that redirect all Java logging events to the Apache's Log4J framework.

    The GeoTools.init() method will select Log4J2LoggerFactory if log4j api is available on the classpath, however if you have several logging libraries on the classpath call GeoTools.setLoggerFactory(Log4J2LoggerFactory#getInstance()).

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

    • Method Detail

      • getImplementation

        protected Logger getImplementation​(String name)
        Returns the implementation to use for the logger of the specified name, or null if the logger would delegates 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()
        Indication of Log4J configuration details, often a configuration filename or setting.
        Overrides:
        lookupConfiguration in class LoggerFactory<Logger>
        Returns:
        Log4J configuration details, often a filename or setting.