public static void configureDefaults()

in src/main/java/com/spotify/logging/LoggingConfigurator.java [190:215]


  public static void configureDefaults(
      final String ident, final Level level, final ReplaceNewLines replaceNewLines) {
    // Call configureSyslogDefaults if the SPOTIFY_SYSLOG_HOST or SPOTIFY_SYSLOG_PORT env var is
    // set. If this causes a problem, we could introduce a configureConsoleDefaults method which
    // users could call instead to avoid this behavior.
    final @Nullable String syslogHost = getSyslogHost();
    final int syslogPort = getSyslogPort();
    if (syslogHost != null || syslogPort != -1) {
      configureSyslogDefaults(ident, level, syslogHost, syslogPort, replaceNewLines);
      return;
    }

    final Logger rootLogger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);

    // Setup context
    final LoggerContext context = setupLoggerContext(rootLogger, ident);

    // Setup stderr output
    rootLogger.addAppender(getStdErrAppender(context, replaceNewLines));

    // Setup logging level
    rootLogger.setLevel(level.logbackLevel);

    // Log uncaught exceptions
    UncaughtExceptionLogger.setDefaultUncaughtExceptionHandler();
  }