use of org.sonar.process.logging.RootLoggerConfig in project sonarqube by SonarSource.
the class SearchLogging method configure.
public LoggerContext configure(Props props) {
LoggerContext ctx = helper.getRootContext();
ctx.reset();
RootLoggerConfig config = newRootLoggerConfigBuilder().setProcessId(ProcessId.ELASTICSEARCH).build();
String logPattern = helper.buildLogPattern(config);
helper.configureGlobalFileLog(props, config, logPattern);
helper.configureForSubprocessGobbler(props, logPattern);
helper.apply(LogLevelConfig.newBuilder().rootLevelFor(ProcessId.ELASTICSEARCH).build(), props);
return ctx;
}
use of org.sonar.process.logging.RootLoggerConfig in project sonarqube by SonarSource.
the class ServerProcessLogging method configureRootLogger.
private void configureRootLogger(Props props) {
RootLoggerConfig config = newRootLoggerConfigBuilder().setProcessId(processId).setThreadIdFieldPattern(threadIdFieldPattern).build();
String logPattern = helper.buildLogPattern(config);
helper.configureGlobalFileLog(props, config, logPattern);
helper.configureForSubprocessGobbler(props, logPattern);
}
use of org.sonar.process.logging.RootLoggerConfig in project sonarqube by SonarSource.
the class ServerProcessLogging method configureDirectToConsoleLoggers.
/**
* Setup one or more specified loggers to be non additive and to print to System.out which will be caught by the Main
* Process and written to sonar.log.
*/
private void configureDirectToConsoleLoggers(LoggerContext context, String... loggerNames) {
RootLoggerConfig config = newRootLoggerConfigBuilder().setProcessId(ProcessId.APP).setThreadIdFieldPattern("").build();
String logPattern = helper.buildLogPattern(config);
ConsoleAppender<ILoggingEvent> consoleAppender = helper.newConsoleAppender(context, "CONSOLE", logPattern);
for (String loggerName : loggerNames) {
Logger consoleLogger = context.getLogger(loggerName);
consoleLogger.setAdditive(false);
consoleLogger.addAppender(consoleAppender);
}
}
use of org.sonar.process.logging.RootLoggerConfig in project sonarqube by SonarSource.
the class ServerProcessLogging method configureRootLogger.
private void configureRootLogger(Props props) {
RootLoggerConfig config = newRootLoggerConfigBuilder().setProcessId(processId).setNodeNameField(getNodeNameWhenCluster(props)).setThreadIdFieldPattern(threadIdFieldPattern).build();
Encoder<ILoggingEvent> encoder = helper.createEncoder(props, config, helper.getRootContext());
helper.configureGlobalFileLog(props, config, encoder);
helper.configureForSubprocessGobbler(props, encoder);
}
use of org.sonar.process.logging.RootLoggerConfig in project sonarqube by SonarSource.
the class ServerProcessLogging method configureDirectToConsoleLoggers.
/**
* Setup one or more specified loggers to be non additive and to print to System.out which will be caught by the Main
* Process and written to sonar.log.
*/
private void configureDirectToConsoleLoggers(Props props, LoggerContext context, String... loggerNames) {
RootLoggerConfig config = newRootLoggerConfigBuilder().setNodeNameField(getNodeNameWhenCluster(props)).setProcessId(ProcessId.APP).setThreadIdFieldPattern("").build();
Encoder<ILoggingEvent> encoder = helper.createEncoder(props, config, context);
ConsoleAppender<ILoggingEvent> consoleAppender = helper.newConsoleAppender(context, "CONSOLE", encoder);
for (String loggerName : loggerNames) {
Logger consoleLogger = context.getLogger(loggerName);
consoleLogger.setAdditive(false);
consoleLogger.addAppender(consoleAppender);
}
}
Aggregations