Search in sources :

Example 1 with OnlyOnceErrorHandler

use of org.apache.log4j.helpers.OnlyOnceErrorHandler in project gerrit by GerritCodeReview.

the class SystemLog method createAppender.

public static Appender createAppender(Path logdir, String name, Layout layout) {
    final DailyRollingFileAppender dst = new DailyRollingFileAppender();
    dst.setName(name);
    dst.setLayout(layout);
    dst.setEncoding(UTF_8.name());
    dst.setFile(resolve(logdir).resolve(name).toString());
    dst.setImmediateFlush(true);
    dst.setAppend(true);
    dst.setErrorHandler(new DieErrorHandler());
    dst.activateOptions();
    dst.setErrorHandler(new OnlyOnceErrorHandler());
    return dst;
}
Also used : DailyRollingFileAppender(org.apache.log4j.DailyRollingFileAppender) OnlyOnceErrorHandler(org.apache.log4j.helpers.OnlyOnceErrorHandler)

Example 2 with OnlyOnceErrorHandler

use of org.apache.log4j.helpers.OnlyOnceErrorHandler in project gerrit by GerritCodeReview.

the class SystemLog method createAppender.

public static Appender createAppender(Path logdir, String name, Layout layout, boolean rotate) {
    final FileAppender dst = rotate ? new DailyRollingFileAppender() : new FileAppender();
    dst.setName(name);
    dst.setLayout(layout);
    dst.setEncoding(UTF_8.name());
    dst.setFile(resolve(logdir).resolve(name).toString());
    dst.setImmediateFlush(true);
    dst.setAppend(true);
    dst.setErrorHandler(new DieErrorHandler());
    dst.activateOptions();
    dst.setErrorHandler(new OnlyOnceErrorHandler());
    return dst;
}
Also used : DailyRollingFileAppender(org.apache.log4j.DailyRollingFileAppender) FileAppender(org.apache.log4j.FileAppender) DailyRollingFileAppender(org.apache.log4j.DailyRollingFileAppender) OnlyOnceErrorHandler(org.apache.log4j.helpers.OnlyOnceErrorHandler)

Aggregations

DailyRollingFileAppender (org.apache.log4j.DailyRollingFileAppender)2 OnlyOnceErrorHandler (org.apache.log4j.helpers.OnlyOnceErrorHandler)2 FileAppender (org.apache.log4j.FileAppender)1