use of ch.qos.logback.core.ConsoleAppender in project midpoint by Evolveum.
the class Log method setupAppender.
private ConsoleAppender setupAppender(String name, String target, LoggerContext ctx, Encoder enc) {
ConsoleAppender appender = new ConsoleAppender();
appender.setName(name);
appender.setTarget(target);
appender.setContext(ctx);
appender.setEncoder(enc);
appender.start();
return appender;
}
use of ch.qos.logback.core.ConsoleAppender in project chunkstories by Hugobros3.
the class LogbackSetupHelper method setupLoggingForTesting.
public static void setupLoggingForTesting() {
ch.qos.logback.classic.Logger rootLogger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
String pattern = "%date %level [%logger] %msg%n";
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
PatternLayoutEncoder ple2 = new PatternLayoutEncoder();
ple2.setPattern(pattern);
ple2.setContext(lc);
ple2.start();
ConsoleAppender<ILoggingEvent> logConsoleAppender = new ConsoleAppender<>();
logConsoleAppender.setContext(lc);
logConsoleAppender.setName("console");
logConsoleAppender.setEncoder(ple2);
logConsoleAppender.start();
rootLogger.addAppender(logConsoleAppender);
rootLogger.setLevel(Level.ALL);
}
use of ch.qos.logback.core.ConsoleAppender in project bgpcep by opendaylight.
the class LoggerUtil method createConsoleAppender.
private static ConsoleAppender<ILoggingEvent> createConsoleAppender(final LoggerContext loggerContext) {
final PatternLayoutEncoder ple = new PatternLayoutEncoder();
ple.setPattern("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{10} - %msg%n");
ple.setContext(loggerContext);
ple.start();
final ConsoleAppender<ILoggingEvent> consoleAppender = new ConsoleAppender<>();
consoleAppender.setContext(loggerContext);
consoleAppender.setEncoder(ple);
consoleAppender.setName("STDOUT");
consoleAppender.start();
return consoleAppender;
}
Aggregations