hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tsz Wo Nicholas Sze (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HDFS-11977) Ozone: cannot enable test debug/trace log
Date Thu, 15 Jun 2017 06:40:00 GMT
Tsz Wo Nicholas Sze created HDFS-11977:
------------------------------------------

             Summary: Ozone: cannot enable test debug/trace log
                 Key: HDFS-11977
                 URL: https://issues.apache.org/jira/browse/HDFS-11977
             Project: Hadoop HDFS
          Issue Type: Sub-task
          Components: ozone, test
            Reporter: Tsz Wo Nicholas Sze
            Assignee: Tsz Wo Nicholas Sze
            Priority: Minor


Interestingly, the test debug/trace logs are not printed for Ozone classes even if we invoke
GenericTestUtils.setLogLevel(log, Level.ALL).  Other classes such as Object do not have such
problem.  Here is a test:
{code}
  @Test
  public void testLogLevel() throws Exception {
    runTestLogLevel(StorageContainerManager.class);
    runTestLogLevel(Object.class);
  }
  static void runTestLogLevel(Class<?> clazz) throws Exception {
    final Logger log = LoggerFactory.getLogger(clazz);
    GenericTestUtils.setLogLevel(log, Level.ALL);
    log.trace(clazz.getSimpleName() + " trace log");
    log.debug(clazz.getSimpleName() + " debug log");
    log.info(clazz.getSimpleName() + " info log");
    log.warn(clazz.getSimpleName() + " warn log");
    log.error(clazz.getSimpleName() + " error log");
  }
{code}    
Output:
{code}
2017-06-15 00:19:07,133 [Thread-0] INFO       - StorageContainerManager info log
2017-06-15 00:19:07,135 [Thread-0] WARN       - StorageContainerManager warn log
2017-06-15 00:19:07,135 [Thread-0] ERROR      - StorageContainerManager error log
2017-06-15 00:19:07,135 [Thread-0] TRACE lang.Object(TestOzoneContainer.java:runTestLogLevel(64))
- Object trace log
2017-06-15 00:19:07,135 [Thread-0] DEBUG lang.Object(TestOzoneContainer.java:runTestLogLevel(65))
- Object debug log
2017-06-15 00:19:07,135 [Thread-0] INFO  lang.Object(TestOzoneContainer.java:runTestLogLevel(66))
- Object info log
2017-06-15 00:19:07,135 [Thread-0] WARN  lang.Object(TestOzoneContainer.java:runTestLogLevel(67))
- Object warn log
2017-06-15 00:19:07,135 [Thread-0] ERROR lang.Object(TestOzoneContainer.java:runTestLogLevel(68))
- Object error log
{code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org


Mime
View raw message