Rename slf4j ref impl, add constants
[logging-analytics.git] / reference / logging-slf4j-demo / src / main / java / org / onap / logging / ref / slf4j / demo / SLF4JRefApplication.java
@@ -30,13 +30,25 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 @SpringBootApplication
 public class SLF4JRefApplication {
 
+    /** System property override, read by embedded Logback configuration. */
+    public static final String SLF4J_OUTPUT_DIRECTORY = "SLF4J_OUTPUT_DIRECTORY";
+
     /**
      * Launch from CLI.
      * @param args command-line args.
      * @throws Exception launch error.
      */
     public static void main(final String[] args) throws Exception {
-        System.getProperties().setProperty("SLF4J_OUTPUT_DIRECTORY", ".");
+        initOutputDirectory();
         SpringApplication.run(SLF4JRefApplication.class, args);
     }
+
+    /**
+     * Make sure the output directory has a default value. (It'll be
+     * overridden by tests, but not in services.)
+     */
+    static void initOutputDirectory() {
+        System.getProperties().setProperty(SLF4J_OUTPUT_DIRECTORY,
+                System.getProperty(SLF4J_OUTPUT_DIRECTORY, "."));
+    }
 }
\ No newline at end of file