zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvz <...@git.apache.org>
Subject [GitHub] zookeeper pull request #148: ZOOKEEPER-2659 Log4j 2 migration
Date Mon, 16 Jan 2017 03:33:12 GMT
Github user jvz commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/148#discussion_r96145357
  
    --- Diff: src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java ---
    @@ -413,13 +418,18 @@ public void testBadPeerAddressInQuorum() throws Exception {
             ClientBase.setupTestEnv();
     
             // setup the logger to capture all logs
    +        LoggerContext loggerContext =  (LoggerContext) LogManager.getContext(false);
    --- End diff --
    
    If this test is just storing log messages for verification at the end of the test, then
I recommend using log4j-core:test's `LoggerContextRule` and `ListAppender`. Example: [LoggerTest](https://github.com/apache/logging-log4j2/blob/master/log4j-core/src/test/java/org/apache/logging/log4j/core/LoggerTest.java),
[config.xml](https://github.com/apache/logging-log4j2/blob/master/log4j-core/src/test/resources/log4j-test2.xml)
(see the `<List name="foo"/>` appender configs). This way, the test won't break if internal
details of log4j-core change.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message