Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-6158

Need a JUnit logging config rule that copies resource to TemporaryFolder and feeds it to LoggerContextRule

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • logging, tests
    • None

    Description

      The integration tests that specify a custom log4j2.xml use the following pattern. I'd like to create a JUnit rule that does all of this without having to set up a @ClassRule and @BeforeClass just to copy a log4j2.xml to a TemporaryFolder to feed to LoggerContextRule.

        @ClassRule
        public static TemporaryFolder temporaryFolder = new TemporaryFolder();
      
        @Rule
        public LoggerContextRule loggerContextRule = new LoggerContextRule(configFilePath);
      
        @BeforeClass
        public static void setUpLogConfigFile() throws Exception {
          URL resource = getResource(CONFIG_FILE_NAME);
          configFilePath = createFileFromResource(resource, temporaryFolder.getRoot(), CONFIG_FILE_NAME)
              .getAbsolutePath();
        }
      

      Attachments

        Activity

          People

            klund Kirk Lund
            klund Kirk Lund
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: