svn commit: r1845903 - /tomcat/trunk/test/org/apache/catalina/startup/LoggingBaseTest.java

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1845903 - /tomcat/trunk/test/org/apache/catalina/startup/LoggingBaseTest.java

markt
Author: markt
Date: Tue Nov  6 12:06:58 2018
New Revision: 1845903

URL: http://svn.apache.org/viewvc?rev=1845903&view=rev
Log:
Logging depends on ${catalina.base} so ensure it is created before logging is configured

Modified:
    tomcat/trunk/test/org/apache/catalina/startup/LoggingBaseTest.java

Modified: tomcat/trunk/test/org/apache/catalina/startup/LoggingBaseTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/LoggingBaseTest.java?rev=1845903&r1=1845902&r2=1845903&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/startup/LoggingBaseTest.java (original)
+++ tomcat/trunk/test/org/apache/catalina/startup/LoggingBaseTest.java Tue Nov  6 12:06:58 2018
@@ -55,7 +55,7 @@ public abstract class LoggingBaseTest {
 
     protected Log log;
 
-    private File tempDir;
+    private static File tempDir;
 
     private List<File> deleteOnTearDown = new ArrayList<>();
 
@@ -104,6 +104,16 @@ public abstract class LoggingBaseTest {
 
     @BeforeClass
     public static void setUpPerTestClass() throws Exception {
+        // Create catalina.base directory
+        File tempBase = new File(System.getProperty("tomcat.test.temp", "output/tmp"));
+        if (!tempBase.mkdirs() && !tempBase.isDirectory()) {
+            Assert.fail("Unable to create base temporary directory for tests");
+        }
+        Path tempBasePath = FileSystems.getDefault().getPath(tempBase.getAbsolutePath());
+        tempDir = Files.createTempDirectory(tempBasePath, "test").toFile();
+
+        System.setProperty("catalina.base", tempDir.getAbsolutePath());
+
         // Configure logging
         System.setProperty("java.util.logging.manager",
                 "org.apache.juli.ClassLoaderLogManager");
@@ -115,16 +125,6 @@ public abstract class LoggingBaseTest {
 
     @Before
     public void setUp() throws Exception {
-        // Create catalina.base directory
-        File tempBase = new File(System.getProperty("tomcat.test.temp", "output/tmp"));
-        if (!tempBase.mkdirs() && !tempBase.isDirectory()) {
-            Assert.fail("Unable to create base temporary directory for tests");
-        }
-        Path tempBasePath = FileSystems.getDefault().getPath(tempBase.getAbsolutePath());
-        tempDir = Files.createTempDirectory(tempBasePath, "test").toFile();
-
-        System.setProperty("catalina.base", tempDir.getAbsolutePath());
-
         log = LogFactory.getLog(getClass());
         log.info("Starting test case [" + testName.getMethodName() + "]");
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]