Class StartupLoggingUtils


  • public final class StartupLoggingUtils
    extends Object
    Handles programmatic modification of logging during startup

    WARNING: This class should only be used during startup. For modifying log levels etc during runtime, SLF4J and LogWatcher must be used.

    • Constructor Detail

      • StartupLoggingUtils

        public StartupLoggingUtils()
    • Method Detail

      • checkLogDir

        public static void checkLogDir()
        Checks whether mandatory log dir is given
      • getLoggerImplStr

        public static String getLoggerImplStr()
      • muteConsole

        public static boolean muteConsole()
        Disables all log4j2 ConsoleAppender's by modifying log4j configuration dynamically. Must only be used during early startup
        Returns:
        true if ok or else false if something happened, e.g. log4j2 classes were not in classpath
      • changeLogLevel

        public static boolean changeLogLevel​(String logLevel)
        Dynamically change log4j log level through property solr.log.level
        Parameters:
        logLevel - String with level, should be one of the supported, e.g. TRACE, DEBUG, INFO, WARN, ERROR...
        Returns:
        true if ok or else false if something happened, e.g. log4j classes were not in classpath
      • getLogLevelString

        public static String getLogLevelString()
        Return a string representing the current static ROOT logging level
        Returns:
        a string TRACE, DEBUG, WARN, ERROR or INFO representing current log level. Default is INFO