[ https://issues.apache.org/jira/browse/LOG4J2-945?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14532571#comment-14532571 ]
Stefan Wehner commented on LOG4J2-945: -------------------------------------- Hey, I'm not sure how to test this exactly - I've attached a small jmh test that test the performance of the StatusLogger itself and the throughput of a regular logger that will filter all events because of the configured level (not sure if this is enough or if you want it to go at least to some appenders). I guess the performance of this will mostly depend on how much logging the different parts of the framework do to the StatusLogger. An appender that will write a lot of debug events to the StatusLogger will see a bigger performance hit than one that doesn't write anything... Let me know if you can think of a better test for this. I'll attach the test code and config to the ticket. These are the results: {code} === Original code: Benchmark (listeners) Mode Samples Score Error Units o.a.l.l.p.j.StatusLoggerBenchmark.normalLoggerThroughput 0 thrpt 5 391930042,237 ± 15094922,663 ops/s o.a.l.l.p.j.StatusLoggerBenchmark.normalLoggerThroughput 9 thrpt 5 389296973,309 ± 10757984,192 ops/s o.a.l.l.p.j.StatusLoggerBenchmark.normalLoggerThroughputBaseline 0 thrpt 5 306778068,820 ± 118109231,263 ops/s o.a.l.l.p.j.StatusLoggerBenchmark.normalLoggerThroughputBaseline 9 thrpt 5 327756139,029 ± 10003735,451 ops/s o.a.l.l.p.j.StatusLoggerBenchmark.statusThroughput 0 thrpt 5 437749350,055 ± 9533272,155 ops/s o.a.l.l.p.j.StatusLoggerBenchmark.statusThroughput 9 thrpt 5 447912170,526 ± 13625870,882 ops/s o.a.l.l.p.j.StatusLoggerBenchmark.statusThroughputBaseline 0 thrpt 5 408068506,204 ± 6465280,135 ops/s o.a.l.l.p.j.StatusLoggerBenchmark.statusThroughputBaseline 9 thrpt 5 398281397,710 ± 110295203,254 ops/s === Remove precomputed listenerslevel: Benchmark (listeners) Mode Samples Score Error Units o.a.l.l.p.j.StatusLoggerBenchmark.normalLoggerThroughput 0 thrpt 5 383945898,841 ± 6801157,672 ops/s o.a.l.l.p.j.StatusLoggerBenchmark.normalLoggerThroughput 9 thrpt 5 390726243,820 ± 13029434,638 ops/s o.a.l.l.p.j.StatusLoggerBenchmark.normalLoggerThroughputBaseline 0 thrpt 5 352607274,875 ± 5588047,095 ops/s o.a.l.l.p.j.StatusLoggerBenchmark.normalLoggerThroughputBaseline 9 thrpt 5 354727757,588 ± 11422886,705 ops/s o.a.l.l.p.j.StatusLoggerBenchmark.statusThroughput 0 thrpt 5 55526024,926 ± 544898,162 ops/s o.a.l.l.p.j.StatusLoggerBenchmark.statusThroughput 9 thrpt 5 26304277,008 ± 671081,416 ops/s o.a.l.l.p.j.StatusLoggerBenchmark.statusThroughputBaseline 0 thrpt 5 54469383,705 ± 1690776,554 ops/s o.a.l.l.p.j.StatusLoggerBenchmark.statusThroughputBaseline 9 thrpt 5 26232921,640 ± 509824,643 ops/s {code} > Reconfiguring statusLogger to a higher level doesn't work correctly > ------------------------------------------------------------------- > > Key: LOG4J2-945 > URL: https://issues.apache.org/jira/browse/LOG4J2-945 > Project: Log4j 2 > Issue Type: Bug > Components: Core > Affects Versions: 2.1 > Reporter: Stefan Wehner > Priority: Minor > Attachments: callback_on_reconfig.patch, remove_listeners_level.patch > > > When reconfiguring log4j and changing the level of the status logger to a > higher level - e.g. from WARN to DEBUG, it doesn't work correctly. > Steps to reproduce: > # Configure from log4j2.xml containing: > {code} > <Configuration status="WARN" monitorInterval="5"> > ... > {code} > # With the app running, change status to a higher level: > {code} > <Configuration status="DEBUG" monitorInterval="5"> > ... > {code} > # Observe that the log config is reloaded, but no debug messages for the > status logger appear. > From what I've seen this is because the {{StatusConfiguration.initialize()}} > reconfigures the listeners' level > [StatusConfig:193|https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;a=blob;f=log4j-core/src/main/java/org/apache/logging/log4j/core/config/status/StatusConfiguration.java;h=4d2ee51b4cf5dcb6f62029fe307093a759bf0af7;hb=HEAD#l193] > But it doesn't update the {{listenersLevel}} field that the {{StatusLogger}} > uses for checking if the logger is enabled (I understand this should be the > maximum of all of the listener's levels) > [StatusLogger:273|https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;a=blob;f=log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java;h=39d447d9793ca08a7d86b9eaaf6ef3dd406cf9a2;hb=HEAD#l273] > So in this case the listenersLevel is still at WARN, even though the console > listener has a DEBUG level, and all the log messages are ignored because > isEnabled(DEBUG) returns false. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org