Search in sources :

Example 1 with JSONEventLayoutV1

use of net.logstash.log4j.JSONEventLayoutV1 in project gerrit by GerritCodeReview.

the class ErrorLogFile method initLogSystem.

private static void initLogSystem(Path logdir, Config config) {
    final Logger root = LogManager.getRootLogger();
    root.removeAllAppenders();
    boolean json = config.getBoolean("log", "jsonLogging", false);
    boolean text = config.getBoolean("log", "textLogging", true) || !json;
    if (text) {
        root.addAppender(SystemLog.createAppender(logdir, LOG_NAME, new PatternLayout("[%d] [%t] %-5p %c %x: %m%n")));
    }
    if (json) {
        root.addAppender(SystemLog.createAppender(logdir, LOG_NAME + JSON_SUFFIX, new JSONEventLayoutV1()));
    }
}
Also used : PatternLayout(org.apache.log4j.PatternLayout) JSONEventLayoutV1(net.logstash.log4j.JSONEventLayoutV1) Logger(org.apache.log4j.Logger)

Aggregations

JSONEventLayoutV1 (net.logstash.log4j.JSONEventLayoutV1)1 Logger (org.apache.log4j.Logger)1 PatternLayout (org.apache.log4j.PatternLayout)1