Uploaded image for project: 'XWiki Commons'
  1. XWiki Commons
  2. XCOMMONS-963

Cannot easily capture logs for the DEBUG level

    Details

    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:

      Description

      If you write:

      public class AllLogRuleDebugLevelTest
      {
          public static final Logger LOGGER = LoggerFactory.getLogger(AllLogRuleDebugLevelTest.class);
      
          @Rule
          public AllLogRule logRule = new AllLogRule(LogLevel.DEBUG);
      
          @Test
          public void staticLogger()
          {
              LOGGER.debug("test1");
              assertEquals("test1", this.logRule.getMessage(0));
          }
      }
      

      This will fail. The reason is that logback-test.xml is used and the root logger is set to WARN (and since DEBUG < WARN nothing will get logged).

      We need AllLogRule to work independently of logback-test.xml

        Attachments

          Activity

            People

            • Assignee:
              vmassol Vincent Massol
              Reporter:
              vmassol Vincent Massol
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: