use of ch.qos.logback.classic.encoder.PatternLayoutEncoder in project TranslateIt-api by zunpiau.
the class LogbackConfig method encoder.
@Bean(initMethod = "start", destroyMethod = "stop")
public static PatternLayoutEncoder encoder(LoggerContext ctx) {
PatternLayoutEncoder encoder = new PatternLayoutEncoder();
encoder.setContext(ctx);
encoder.setPattern("%d{yy-MM-dd HH:mm:ss.SSS} [%-5level] [%thread] %logger - %msg%n");
return encoder;
}
use of ch.qos.logback.classic.encoder.PatternLayoutEncoder in project midpoint by Evolveum.
the class Log method init.
private void init() {
opts = NinjaUtils.getOptions(context.getJc(), BaseOptions.class);
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
PatternLayoutEncoder ple = new PatternLayoutEncoder();
if (opts.isVerbose()) {
ple.setPattern("%date [%thread] %-5level \\(%logger{46}\\): %message%n<");
} else {
ple.setPattern("%msg%n");
}
ple.setContext(lc);
ple.start();
ConsoleAppender out = setupAppender("STDOUT", "System.out", lc, setupEncoder(lc));
ConsoleAppender err = setupAppender("STDERR", "System.err", lc, setupEncoder(lc));
Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
if (LogTarget.SYSTEM_OUT.equals(target)) {
root.addAppender(out);
} else {
root.addAppender(err);
}
root.setLevel(Level.OFF);
info = setupLogger(LOGGER_SYS_OUT, opts);
error = setupLogger(LOGGER_SYS_ERR, opts);
error.setAdditive(false);
error.addAppender(err);
}
use of ch.qos.logback.classic.encoder.PatternLayoutEncoder in project midpoint by Evolveum.
the class Log method setupEncoder.
private Encoder setupEncoder(LoggerContext ctx) {
PatternLayoutEncoder ple = new PatternLayoutEncoder();
if (opts.isVerbose()) {
ple.setPattern("%date [%thread] %-5level \\(%logger{46}\\): %message%n");
} else {
ple.setPattern("%msg%n");
}
ple.setContext(ctx);
ple.start();
return ple;
}
use of ch.qos.logback.classic.encoder.PatternLayoutEncoder in project jmxtrans by jmxtrans.
the class KeyOutWriter method buildEncoder.
protected Encoder buildEncoder() {
PatternLayoutEncoder encoder = new PatternLayoutEncoder();
encoder.setContext(loggerContext);
encoder.setPattern(logPattern);
encoder.start();
return encoder;
}
use of ch.qos.logback.classic.encoder.PatternLayoutEncoder in project TOSCAna by StuPro-TOSCAna.
the class PersistentAppender method setupLayout.
private void setupLayout(LoggerContext lc) {
PatternLayoutEncoder ple = new PatternLayoutEncoder();
ple.setPattern(PATTERN_LAYOUT);
ple.setContext(lc);
ple.start();
setEncoder(ple);
}
Aggregations