异步日志

Log4j 2 Asynchronous Loggers for Low-Latency Logging - Apache Log4j 2

Log4j 2使用Disruptor实现异步日志,获得低延时和高吞吐量。

配置如下

<configuration status="WARN">
  <appenders>
    <!-- Async Loggers will auto-flush in batches, so switch off immediateFlush. -->
    <FastFile name="FastFile" fileName="async.log" immediateFlush="false" append="false">
      <PatternLayout>
        <pattern>%d %p %c{1.} [%t] %m %ex%n</pattern>
      </PatternLayout>
    </FastFile>
  </appenders>
  <loggers>
    <root level="info" includeLocation="false">
      <appender-ref ref="FastFile"/>
    </root>
  </loggers>
</configuration>

你可能感兴趣的:(日志)