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

    • Type: Wish
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: logging, tests
    • Labels:
      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

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

              Dates

              • Created:
                Updated: