Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-7240 Scaling HDFS
  3. HDFS-11977

Ozone: cannot enable test debug/trace log

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: HDFS-7240
    • Component/s: ozone, test
    • Labels:
      None
    • Target Version/s:
    • Hadoop Flags:
      Reviewed

      Description

      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:

        @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");
        }
      

      Output:

      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
      

        Attachments

          Activity

            People

            • Assignee:
              szetszwo Tsz-wo Sze
              Reporter:
              szetszwo Tsz-wo Sze

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment