[ https://issues.apache.org/jira/browse/HDFS-11977?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tsz Wo Nicholas Sze updated HDFS-11977: --------------------------------------- Attachment: HDFS-11977-HDFS-7240.20170615.patch HDFS-11977-HDFS-7240.20170615.patch: sets the default level to INFO and the threshold to ALL. > 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 > Attachments: HDFS-11977-HDFS-7240.20170615.patch > > > 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-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org