Skip to content

jdk-log,log4j1,log4j2,logback日志框架性能对比

Notifications You must be signed in to change notification settings

moowcharnfu/log-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

                                                性能测试结果分析
-------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------
             日志框架                                    50线程/50数据       50线程/100数据       50线程/200数据
 jdk-log文件输出(单文件,只做测试演练)                      31300ms            63934ms             121874ms
 log4j1同步文件输出(info,debug也会操作)                   688515ms           1304690ms           2650855ms
 log4j2同步文件输出(info,debug也会操作)                   1176764ms          2624925ms           4783789ms
 log4j2异步文件AsyncLogger输出(info,debug也会操作)        10183ms            17327ms             26390ms||30378ms(第二次)
 logback同步文件输出(info,debug也会操作)                  18368ms            52796ms             125877ms||216136ms(第二次)
 logback异步文件输出(info,debug也会操作)                  33140ms            37004ms             384750ms
-------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------

感兴趣的朋友可以查下 ArrayBlockingQueue (logback使用) 和 Disruptor (log4j2使用)的性能对比情况,Disruptor完胜。
综上本次测试的结果来看,logback的效果还是可观的,一般场景下采用同步文件操作即可满足;log4j2异步性能更好,取决于高性能框架Disruptor的效果;
最终结果:
    上手难度:logback < log4j2;
    性能效果:
        同步:logback > log4j2;
        异步:log4j2 > logback。

About

jdk-log,log4j1,log4j2,logback日志框架性能对比

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages