l14107cb 发表于 2024-10-8 14:33:03

Log4j1、Logback 以及 Log4j2 性能测试对


    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">点击上方“</span><span style="color: black;">芋道源码</span><span style="color: black;">”,<span style="color: black;">选取</span>“设为星标”</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">做积极的人,而不是积极废人!</span></p><span style="color: black;">
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">源码精品专栏</p>
    </span>&nbsp;<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">精尽 Dubbo 原理与源码&nbsp;69 篇</span></a></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">精尽 Netty 原理与源码&nbsp;61 篇</span></a></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">中文<span style="color: black;">仔细</span>注释的开源项目</span></a></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">Java 并发源码合集</span></a></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">RocketMQ 源码合集</span></a></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">Sharding-JDBC 源码解析合集</span></a></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">Spring MVC 和 Secur</span></a>ity 源码合集</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">MyCAT 源码解析合集</span></a></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">源自</span>:https://dwz.cn/woS9vbcQ</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">环境</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">准备</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">测试</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">结果</p>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">环境</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">jdk:1.7.0_79</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">cpu:i5-4570@3.20GHz 4核</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">eclipse:3.7</p>操作系统:win7
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">准备</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">1.log4j:1.7.21</strong></p><span style="color: black;">&lt;<span style="color: black;">dependency</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">groupId</span>&gt;</span>org.slf4j<span style="color: black;">&lt;/<span style="color: black;">groupId</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">artifactId</span>&gt;</span>slf4j-log4j12<span style="color: black;">&lt;/<span style="color: black;">artifactId</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">version</span>&gt;</span>1.7.21<span style="color: black;">&lt;/<span style="color: black;">version</span>&gt;</span><span style="color: black;">&lt;/<span style="color: black;">dependency</span>&gt;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">log4j.xml</strong></p><span style="color: black;">&lt;?xml&nbsp;version="1.0"&nbsp;encoding="UTF-8"?&gt;</span><span style="color: black;">&lt;!DOCTYPE&nbsp;log4j:configuration&nbsp;SYSTEM&nbsp;"log4j.dtd"&gt;</span><span style="color: black;">&lt;<span style="color: black;">log4j:configuration</span>&nbsp;<span style="color: black;">xmlns:log4j</span>=<span style="color: black;">http://jakarta.apache.org/log4j/</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">appender</span>&nbsp;<span style="color: black;">name</span>=<span style="color: black;">"myConsole"</span>&nbsp;<span style="color: black;">class</span>=<span style="color: black;">"org.apache.log4j.ConsoleAppender"</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">layout</span>&nbsp;<span style="color: black;">class</span>=<span style="color: black;">"org.apache.log4j.PatternLayout"</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">param</span>&nbsp;<span style="color: black;">name</span>=<span style="color: black;">"ConversionPattern"</span>&nbsp;<span style="color: black;">value</span>=<span style="color: black;">"[%d{dd&nbsp;HH:mm:ss,SSS\}&nbsp;%-5p]&nbsp;[%t]&nbsp;%c{2\}&nbsp;-&nbsp;%m%n"</span>/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">layout</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;!--过滤器设置输出的级别&nbsp;--&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">filter</span>&nbsp;<span style="color: black;">class</span>=<span style="color: black;">"org.apache.log4j.varia.LevelRangeFilter"</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">param</span>&nbsp;<span style="color: black;">name</span>=<span style="color: black;">"levelMin"</span>&nbsp;<span style="color: black;">value</span>=<span style="color: black;">"debug"</span>&nbsp;/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">param</span>&nbsp;<span style="color: black;">name</span>=<span style="color: black;">"levelMax"</span>&nbsp;<span style="color: black;">value</span>=<span style="color: black;">"warn"</span>&nbsp;/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">param</span>&nbsp;<span style="color: black;">name</span>=<span style="color: black;">"AcceptOnMatch"</span>&nbsp;<span style="color: black;">value</span>=<span style="color: black;">"true"</span>&nbsp;/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">filter</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">appender</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">appender</span>&nbsp;<span style="color: black;">name</span>=<span style="color: black;">"myFile"</span>&nbsp;<span style="color: black;">class</span>=<span style="color: black;">"org.apache.log4j.DailyRollingFileAppender"</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">param</span>&nbsp;<span style="color: black;">name</span>=<span style="color: black;">"File"</span>&nbsp;<span style="color: black;">value</span>=<span style="color: black;">"log4jTest.log"</span>&nbsp;/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">param</span>&nbsp;<span style="color: black;">name</span>=<span style="color: black;">"Append"</span>&nbsp;<span style="color: black;">value</span>=<span style="color: black;">"true"</span>&nbsp;/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">param</span>&nbsp;<span style="color: black;">name</span>=<span style="color: black;">"DatePattern"</span>&nbsp;<span style="color: black;">value</span>=<span style="color: black;">".yyyy-MM-dd.log"</span>&nbsp;/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">layout</span>&nbsp;<span style="color: black;">class</span>=<span style="color: black;">"org.apache.log4j.PatternLayout"</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">param</span>&nbsp;<span style="color: black;">name</span>=<span style="color: black;">"ConversionPattern"</span>&nbsp;<span style="color: black;">value</span>=<span style="color: black;">"[%t]&nbsp;-&nbsp;%m%n"</span>&nbsp;/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">layout</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">appender</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">appender</span>&nbsp;<span style="color: black;">name</span>=<span style="color: black;">"async_file"</span>&nbsp;<span style="color: black;">class</span>=<span style="color: black;">"org.apache.log4j.AsyncAppender"</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">param</span>&nbsp;<span style="color: black;">name</span>=<span style="color: black;">"BufferSize"</span>&nbsp;<span style="color: black;">value</span>=<span style="color: black;">"32"</span>&nbsp;/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">appender-ref</span>&nbsp;<span style="color: black;">ref</span>=<span style="color: black;">"myFile"</span>&nbsp;/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">appender</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">logger</span>&nbsp;<span style="color: black;">name</span>=<span style="color: black;">"org.logTest"</span>&nbsp;<span style="color: black;">additivity</span>=<span style="color: black;">"false"</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">level</span>&nbsp;<span style="color: black;">value</span>=<span style="color: black;">"info"</span>&nbsp;/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">appender-ref</span>&nbsp;<span style="color: black;">ref</span>=<span style="color: black;">"async_file"</span>&nbsp;/&gt;</span>&nbsp;<span style="color: black;">&lt;!--&nbsp;同步:FILE&nbsp;异步:async_file&nbsp;--&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">logger</span>&gt;</span><span style="color: black;">&lt;/<span style="color: black;">log4j:configuration</span>&gt;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">2.logback:1.1.7</strong></p><span style="color: black;">&lt;<span style="color: black;">dependency</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">groupId</span>&gt;</span>ch.qos.logback<span style="color: black;">&lt;/<span style="color: black;">groupId</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">artifactId</span>&gt;</span>logback-classic<span style="color: black;">&lt;/<span style="color: black;">artifactId</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">version</span>&gt;</span>1.1.7<span style="color: black;">&lt;/<span style="color: black;">version</span>&gt;</span><span style="color: black;">&lt;/<span style="color: black;">dependency</span>&gt;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">logback.xml</strong></p><span style="color: black;">&lt;<span style="color: black;">configuration</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">appender</span>&nbsp;<span style="color: black;">name</span>=<span style="color: black;">"STDOUT"</span>&nbsp;<span style="color: black;">class</span>=<span style="color: black;">"ch.qos.logback.core.ConsoleAppender"</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;!--&nbsp;encoder&nbsp;默认配置为PatternLayoutEncoder&nbsp;--&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">encoder</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">pattern</span>&gt;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">%d{HH:mm:ss.SSS}&nbsp;[%thread]&nbsp;%-5level&nbsp;%logger{36}&nbsp;-&nbsp;%msg%n</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">pattern</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">encoder</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">appender</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">appender</span>&nbsp;<span style="color: black;">name</span>=<span style="color: black;">"FILE"</span>&nbsp;<span style="color: black;">class</span>=<span style="color: black;">"ch.qos.logback.core.FileAppender"</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">file</span>&gt;</span>testFile.log<span style="color: black;">&lt;/<span style="color: black;">file</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">append</span>&gt;</span>true<span style="color: black;">&lt;/<span style="color: black;">append</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">encoder</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">pattern</span>&gt;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">[%t]&nbsp;-&nbsp;%m%n</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">pattern</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">encoder</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">appender</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;!--&nbsp;异步输出&nbsp;--&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">appender</span>&nbsp;<span style="color: black;">name</span>=<span style="color: black;">"ASYNC"</span>&nbsp;<span style="color: black;">class</span>=<span style="color: black;">"ch.qos.logback.classic.AsyncAppender"</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">discardingThreshold</span>&gt;</span>0<span style="color: black;">&lt;/<span style="color: black;">discardingThreshold</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">appender-ref</span>&nbsp;<span style="color: black;">ref</span>=<span style="color: black;">"FILE"</span>&nbsp;/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">appender</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">logger</span>&nbsp;<span style="color: black;">name</span>=<span style="color: black;">"org.logTest"</span>&nbsp;<span style="color: black;">level</span>=<span style="color: black;">"INFO"</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">additivity</span>=<span style="color: black;">"false"</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">appender-ref</span>&nbsp;<span style="color: black;">ref</span>=<span style="color: black;">"ASYNC"</span>&nbsp;/&gt;</span>&nbsp;&nbsp;<span style="color: black;">&lt;!--&nbsp;同步:FILE&nbsp;异步:ASYNC--&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">logger</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">root</span>&nbsp;<span style="color: black;">level</span>=<span style="color: black;">"ERROR"</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">appender-ref</span>&nbsp;<span style="color: black;">ref</span>=<span style="color: black;">"STDOUT"</span>&nbsp;/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">root</span>&gt;</span><span style="color: black;">&lt;/<span style="color: black;">configuration</span>&gt;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">3.log4j2:2.6.2</strong></p><span style="color: black;">&lt;<span style="color: black;">dependency</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">groupId</span>&gt;</span>org.apache.logging.log4j<span style="color: black;">&lt;/<span style="color: black;">groupId</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">artifactId</span>&gt;</span>log4j-core<span style="color: black;">&lt;/<span style="color: black;">artifactId</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">version</span>&gt;</span>2.6.2<span style="color: black;">&lt;/<span style="color: black;">version</span>&gt;</span><span style="color: black;">&lt;/<span style="color: black;">dependency</span>&gt;</span><span style="color: black;">&lt;<span style="color: black;">dependency</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">groupId</span>&gt;</span>org.apache.logging.log4j<span style="color: black;">&lt;/<span style="color: black;">groupId</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">artifactId</span>&gt;</span>log4j-slf4j-impl<span style="color: black;">&lt;/<span style="color: black;">artifactId</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">version</span>&gt;</span>2.6.2<span style="color: black;">&lt;/<span style="color: black;">version</span>&gt;</span><span style="color: black;">&lt;/<span style="color: black;">dependency</span>&gt;</span><span style="color: black;">&lt;<span style="color: black;">dependency</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">groupId</span>&gt;</span>com.lmax<span style="color: black;">&lt;/<span style="color: black;">groupId</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">artifactId</span>&gt;</span>disruptor<span style="color: black;">&lt;/<span style="color: black;">artifactId</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">version</span>&gt;</span>3.3.4<span style="color: black;">&lt;/<span style="color: black;">version</span>&gt;</span><span style="color: black;">&lt;/<span style="color: black;">dependency</span>&gt;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">log4j2.xml</strong></p><span style="color: black;">&lt;?xml&nbsp;version="1.0"&nbsp;encoding="UTF-8"?&gt;</span><span style="color: black;">&lt;!--设置log4j2的<span style="color: black;">自己</span>log级别为warn&nbsp;--&gt;</span><span style="color: black;">&lt;<span style="color: black;">configuration</span>&nbsp;<span style="color: black;">status</span>=<span style="color: black;">"warn"</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">appenders</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">console</span>&nbsp;<span style="color: black;">name</span>=<span style="color: black;">"Console"</span>&nbsp;<span style="color: black;">target</span>=<span style="color: black;">"SYSTEM_OUT"</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">PatternLayout</span>&nbsp;<span style="color: black;">pattern</span>=<span style="color: black;">"[%d{HH:mm:ss:SSS}]&nbsp;[%p]&nbsp;-&nbsp;%l&nbsp;-&nbsp;%m%n"</span>&nbsp;/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">console</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">RollingFile</span>&nbsp;<span style="color: black;">name</span>=<span style="color: black;">"RollingFileInfo"</span>&nbsp;<span style="color: black;">fileName</span>=<span style="color: black;">"info.log"</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">filePattern</span>=<span style="color: black;">"${sys:user.home}/logs/hpaasvc/$${date:yyyy-MM}/info-%d{yyyy-MM-dd}-%i.log"</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">Filters</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">ThresholdFilter</span>&nbsp;<span style="color: black;">level</span>=<span style="color: black;">"INFO"</span>&nbsp;/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">ThresholdFilter</span>&nbsp;<span style="color: black;">level</span>=<span style="color: black;">"WARN"</span>&nbsp;<span style="color: black;">onMatch</span>=<span style="color: black;">"DENY"</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">onMismatch</span>=<span style="color: black;">"NEUTRAL"</span>&nbsp;/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">Filters</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">PatternLayout</span>&nbsp;<span style="color: black;">pattern</span>=<span style="color: black;">"[%t]&nbsp;-&nbsp;%m%n"</span>&nbsp;/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">Policies</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">TimeBasedTriggeringPolicy</span>&nbsp;/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">SizeBasedTriggeringPolicy</span>&nbsp;<span style="color: black;">size</span>=<span style="color: black;">"100&nbsp;MB"</span>&nbsp;/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">Policies</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">RollingFile</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">RandomAccessFile</span>&nbsp;<span style="color: black;">name</span>=<span style="color: black;">"RandomAccessFile"</span>&nbsp;<span style="color: black;">fileName</span>=<span style="color: black;">"asyncWithLocation.log"</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">immediateFlush</span>=<span style="color: black;">"false"</span>&nbsp;<span style="color: black;">append</span>=<span style="color: black;">"true"</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">PatternLayout</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">Pattern</span>&gt;</span>[%t]&nbsp;-&nbsp;%m%n<span style="color: black;">&lt;/<span style="color: black;">Pattern</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">PatternLayout</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">RandomAccessFile</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">appenders</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">loggers</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;includeLocation="true"&gt;</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/AsyncLogger&gt;&nbsp;--&gt;
    </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">Root</span>&nbsp;<span style="color: black;">level</span>=<span style="color: black;">"info"</span>&nbsp;<span style="color: black;">includeLocation</span>=<span style="color: black;">"true"</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;<span style="color: black;">AppenderRef</span>&nbsp;<span style="color: black;">ref</span>=<span style="color: black;">"RollingFileInfo"</span>&nbsp;/&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">Root</span>&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">&lt;/<span style="color: black;">loggers</span>&gt;</span><span style="color: black;">&lt;/<span style="color: black;">configuration</span>&gt;</span>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">测试</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">准备50条线程<span style="color: black;">同期</span>记录1000000条数据,<span style="color: black;">而后</span>统计时间,<span style="color: black;">仔细</span>代码如下:</p><span style="color: black;">import</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">java.util.concurrent.CountDownLatch;</p><span style="color: black;">import</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;org.slf4j.Logger;</p><span style="color: black;">import</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;org.slf4j.LoggerFactory;</p><span style="color: black;">public</span>&nbsp;<span style="color: black;"><span style="color: black;">class</span>&nbsp;<span style="color: black;">App</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">private</span>&nbsp;<span style="color: black;">static</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;Logger&nbsp;log&nbsp;=&nbsp;LoggerFactory.getLogger(App.class);</p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;<span style="color: black;">static</span>&nbsp;<span style="color: black;">void</span>&nbsp;<span style="color: black;">main</span><span style="color: black;">(String[]&nbsp;args)</span>&nbsp;<span style="color: black;">throws</span>&nbsp;InterruptedException&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">int</span>&nbsp;messageSize&nbsp;=&nbsp;<span style="color: black;">1000000</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">int</span>&nbsp;threadSize&nbsp;=&nbsp;<span style="color: black;">50</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">final</span>&nbsp;<span style="color: black;">int</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;everySize&nbsp;=&nbsp;messageSize&nbsp;/&nbsp;threadSize;</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">final</span>CountDownLatch&nbsp;cdl&nbsp;=<span style="color: black;">new</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;CountDownLatch(threadSize);</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">long</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;startTime&nbsp;=&nbsp;System.currentTimeMillis();</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">for</span>&nbsp;(<span style="color: black;">int</span>&nbsp;ts&nbsp;=&nbsp;<span style="color: black;">0</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;&nbsp;ts&nbsp;&lt;&nbsp;threadSize;&nbsp;ts++)&nbsp;{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">new</span>&nbsp;Thread(<span style="color: black;">new</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;Runnable()&nbsp;{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">@Override</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;"><span style="color: black;">public</span>&nbsp;<span style="color: black;">void</span>&nbsp;<span style="color: black;">run</span><span style="color: black;">()</span>&nbsp;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">for</span>&nbsp;(<span style="color: black;">int</span>&nbsp;es&nbsp;=&nbsp;<span style="color: black;">0</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">;&nbsp;es&nbsp;&lt;&nbsp;everySize;&nbsp;es++)&nbsp;{</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log.info(<span style="color: black;">"======info"</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">);</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cdl.countDown();</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}).start();</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cdl.await();</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: black;">long</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">endTime&nbsp;=&nbsp;System.currentTimeMillis();</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(<span style="color: black;">"log4j1:messageSize&nbsp;=&nbsp;"</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;+&nbsp;messageSize</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;<span style="color: black;">",threadSize&nbsp;=&nbsp;"</span>&nbsp;+&nbsp;threadSize&nbsp;+&nbsp;<span style="color: black;">",costTime&nbsp;=&nbsp;"</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;(endTime&nbsp;-&nbsp;startTime)&nbsp;+&nbsp;<span style="color: black;">"ms"</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">);</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">}</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">log4j1和logback的同步和异步分别修改为对应的appender就行了</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">log4j2的异步方式<span style="color: black;">供给</span>了2中模式:</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">1.全局开启</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">设置Log4jContextSelector系统属性为:</p>org.apache.logging.log4j.core.async.AsyncLoggerContextSelectorSystem.setProperty(<span style="color: black;">"Log4jContextSelector"</span>,&nbsp;<span style="color: black;">"org.apache.logging.log4j.core.async.AsyncLoggerContextSelector"</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">);</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">2.混合同步异步模式</p>不需要设置Log4jContextSelector,<span style="color: black;">然则</span>需要<span style="color: black;">运用</span>AsyncLogger标签
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">更加多</span><span style="color: black;">仔细</span>参考官方文档:http://logging.apache.org/log4j/2.x/manual/async.html#AllAsync</p>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">结果</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">分别测试完以后统计成表格如下:</p><img src="https://mmbiz.qpic.cn/mmbiz_png/JdLkEI9sZfe39A5picdNfpqh5RI8Hlk8TqNnNicqEKLC77LsIZ33BibepJ8p1ynRbWR9jicMic78mM8N5QOsD4EXQ4A/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;">img<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">log4j2的异步模式表现了绝对的性能<span style="color: black;">优良</span>,<span style="color: black;">优良</span><span style="color: black;">重点</span>得益于Disruptor框架的<span style="color: black;">运用</span></p>LMAX&nbsp;Disruptor&nbsp;technology.&nbsp;Asynchronous&nbsp;Loggers&nbsp;internally<span style="color: black;">use</span>&nbsp;the&nbsp;Disruptor,&nbsp;a&nbsp;<span style="color: black;">lock</span>-free&nbsp;inter-<span style="color: black;">thread</span>&nbsp;communication&nbsp;<span style="color: black;">library</span>,&nbsp;instead&nbsp;<span style="color: black;">of</span>&nbsp;queues,&nbsp;resulting&nbsp;<span style="color: black;">in</span>higher&nbsp;throughput<span style="color: black;">and</span>&nbsp;<span style="color: black;">lower</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&nbsp;latency.</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">一个无锁的线程间通信库代替了原来的队列</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">更加多</span>Disruptor :</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">http://developer.51cto.com/art/201306/399370.htm</p>http://ifeve.com/disruptor/
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">欢迎加入我的知识星球,<span style="color: black;">一块</span>探讨架构,交流源码。加入方式,<strong style="color: blue;"><span style="color: black;">长按下方二维码噢</span></strong>:</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_jpg/JdLkEI9sZffVTY1cbQPIhsMGJcNWFwIDn1HomDs3KMQdVdSpmRkicibAFj9FzVtNtQxAtyAhyqmo1N8aibviaU4Qxg/640?wx_fmt=jpeg&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">已在知识星球更新源码解析如下:</p>

    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_png/JdLkEI9sZffUCBXGfVvL7KsDg2TYdzcIrqcNU2F1G46mzD0dTd7pBNV8NLyWIOXAwm2iadbdybHVL65dhTmg8YQ/640?tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_png/JdLkEI9sZffUCBXGfVvL7KsDg2TYdzcIxYiajjv1MycMd7pkQbQ5WPBcEsHNKYnoFRYqbjjloz00f8ibDic1dv2yQ/640?tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_png/JdLkEI9sZffUCBXGfVvL7KsDg2TYdzcIicGZMIzqr2IIQHsAZdkG0tAibAOTQRHVfOZvicA9Qo2ica4HgX72ibE6jMQ/640?tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_gif/JdLkEI9sZffVTY1cbQPIhsMGJcNWFwIDS4C592uCNnJsdPCVw72HHvM9ictRn1vUOW7C7Wa8ccNXtK1O86OibGYg/640?wx_fmt=gif&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1" style="width: 50%; margin-bottom: 20px;"></p>




m5k1umn 发表于 2024-11-1 11:15:50

回顾历史,我们不难发现:无数先辈用鲜血和生命铺就了中华民族复兴的康庄大道。

j8typz 发表于 6 天前

期待与你深入交流,共探知识的无穷魅力。
页: [1]
查看完整版本: Log4j1、Logback 以及 Log4j2 性能测试对