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

Cannot easily capture logs for the DEBUG level

    XMLWordPrintable

Details

    • N/A
    • N/A

    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

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

            Dates

              Created:
              Updated:
              Resolved: