aboutsummaryrefslogtreecommitdiffstats
path: root/reference/logging-slf4j-demo
diff options
context:
space:
mode:
Diffstat (limited to 'reference/logging-slf4j-demo')
-rw-r--r--reference/logging-slf4j-demo/README.md31
-rw-r--r--reference/logging-slf4j-demo/src/main/java/org/onap/logging/ref/slf4j/demo/SLF4JRefApplication.java6
-rw-r--r--reference/logging-slf4j-demo/src/test/java/org/onap/logging/ref/slf4j/CallGraphTest.java2
-rw-r--r--reference/logging-slf4j-demo/src/test/java/org/onap/logging/ref/slf4j/demo/SLF4JRefApplicationTest.java6
-rw-r--r--reference/logging-slf4j-demo/src/test/resources/logback.xml (renamed from reference/logging-slf4j-demo/src/main/resources/logback.xml)2
5 files changed, 11 insertions, 36 deletions
diff --git a/reference/logging-slf4j-demo/README.md b/reference/logging-slf4j-demo/README.md
index 4434964..83f9f80 100644
--- a/reference/logging-slf4j-demo/README.md
+++ b/reference/logging-slf4j-demo/README.md
@@ -2,31 +2,6 @@
This project gives an example of ONAP-compliant logging using SLF4J logging.
-## Adapter
-
-In ```org.onap.logging.ref.slf4j.common```, there are TWO classes:
-1. ```org.onap.logging.ref.slf4j.common.ONAPLogConstants```, providing declarations of standard ONAP Markers, MDCs and HTTP headers.
-2. ```org.onap.logging.ref.slf4j.common.ONAPLogAdapter```, providing a lightweight, compliant implementation of the ONAP logging spec.
-
-The adapter provides:
-1. A loosely-coupled SLF4j logging wrapper:
- * To be used for logging ONAP ```entry```, ```exit``` and ```invoke``` behavior.
- * Devolving all *application* logging to the component, via the regular SLF4J ```Logger``` facade.
-2. Customization options:
- * *Cheap*, by way of bean properties. This is suited to most Use Cases.
- * *Sophisticated*:
- * By OPTIONALLY implementing one of a number of adapters:
- * ```RequestAdapter``` to read incoming headers.
- * ```ServiceDescriptor``` for reporting attributes of the current service.
- * ```ResponseDescriptor``` for reporting outcomes.
- * ```RequestBuilder``` for setting southbound request headers.
- * By OPTIONALLY overriding methods like ```ONAPLogAdapter#setMDCs(RequestAdapter)```.
-
-Note that:
-* The adapter implementation uses static inner classes in order to fit in a single source file. This was an objective.
-
-## WAR
-
Building produces a simple (spring-boot](https://projects.spring.io/spring-boot/) example WAR, which can be launched from this directory with:
```bash
@@ -45,6 +20,6 @@ The purpose of this WAR is to demonstrate minimalist ONAP-compliant logging for
## Tests
-Tests for:
-1. Code in the (potentially) reusable ``common`` package.
-2. Validating that emitted logs can be used to generate an unambiguous call graph.
+Tests for verifying that emitted logs can be used to generate an unambiguous call graph.
+
+Note that these run in-process, despite the WAR packaging. The intent is to enable tests via HTTP transports.
diff --git a/reference/logging-slf4j-demo/src/main/java/org/onap/logging/ref/slf4j/demo/SLF4JRefApplication.java b/reference/logging-slf4j-demo/src/main/java/org/onap/logging/ref/slf4j/demo/SLF4JRefApplication.java
index 146f66b..ff2fa2f 100644
--- a/reference/logging-slf4j-demo/src/main/java/org/onap/logging/ref/slf4j/demo/SLF4JRefApplication.java
+++ b/reference/logging-slf4j-demo/src/main/java/org/onap/logging/ref/slf4j/demo/SLF4JRefApplication.java
@@ -31,7 +31,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
public class SLF4JRefApplication {
/** System property override, read by embedded Logback configuration. */
- public static final String SLF4J_OUTPUT_DIRECTORY = "SLF4J_OUTPUT_DIRECTORY";
+ public static final String TESTNG_SLF4J_OUTPUT_DIRECTORY = "TESTNG_SLF4J_OUTPUT_DIRECTORY";
/**
* Launch from CLI.
@@ -48,7 +48,7 @@ public class SLF4JRefApplication {
* overridden by tests, but not in services.)
*/
static void initOutputDirectory() {
- System.getProperties().setProperty(SLF4J_OUTPUT_DIRECTORY,
- System.getProperty(SLF4J_OUTPUT_DIRECTORY, "."));
+ System.getProperties().setProperty(TESTNG_SLF4J_OUTPUT_DIRECTORY,
+ System.getProperty(TESTNG_SLF4J_OUTPUT_DIRECTORY, "."));
}
} \ No newline at end of file
diff --git a/reference/logging-slf4j-demo/src/test/java/org/onap/logging/ref/slf4j/CallGraphTest.java b/reference/logging-slf4j-demo/src/test/java/org/onap/logging/ref/slf4j/CallGraphTest.java
index 3d123e0..cc52cf3 100644
--- a/reference/logging-slf4j-demo/src/test/java/org/onap/logging/ref/slf4j/CallGraphTest.java
+++ b/reference/logging-slf4j-demo/src/test/java/org/onap/logging/ref/slf4j/CallGraphTest.java
@@ -58,7 +58,7 @@ public class CallGraphTest {
public static void setUp() throws Exception {
AbstractComponentTest.setInProcess();
sDir = Files.createTempDirectory(CallGraphTest.class.getName()).toFile();
- System.getProperties().setProperty("SLF4J_OUTPUT_DIRECTORY", sDir.getAbsolutePath());
+ System.getProperties().setProperty("TESTNG_SLF4J_OUTPUT_DIRECTORY", sDir.getAbsolutePath());
LoggerFactory.getLogger(CallGraphTest.class).info("Starting.");
}
diff --git a/reference/logging-slf4j-demo/src/test/java/org/onap/logging/ref/slf4j/demo/SLF4JRefApplicationTest.java b/reference/logging-slf4j-demo/src/test/java/org/onap/logging/ref/slf4j/demo/SLF4JRefApplicationTest.java
index a01cbe8..43f8746 100644
--- a/reference/logging-slf4j-demo/src/test/java/org/onap/logging/ref/slf4j/demo/SLF4JRefApplicationTest.java
+++ b/reference/logging-slf4j-demo/src/test/java/org/onap/logging/ref/slf4j/demo/SLF4JRefApplicationTest.java
@@ -34,14 +34,14 @@ public class SLF4JRefApplicationTest {
@Test
public void testProperty() {
- assertThat(SLF4JRefApplication.SLF4J_OUTPUT_DIRECTORY,
- is("SLF4J_OUTPUT_DIRECTORY"));
+ assertThat(SLF4JRefApplication.TESTNG_SLF4J_OUTPUT_DIRECTORY,
+ is("TESTNG_SLF4J_OUTPUT_DIRECTORY"));
}
@Test
public void testInitOutputDirectory() throws Exception {
SLF4JRefApplication.initOutputDirectory();
- assertThat(System.getProperty(SLF4JRefApplication.SLF4J_OUTPUT_DIRECTORY),
+ assertThat(System.getProperty(SLF4JRefApplication.TESTNG_SLF4J_OUTPUT_DIRECTORY),
notNullValue());
}
}
diff --git a/reference/logging-slf4j-demo/src/main/resources/logback.xml b/reference/logging-slf4j-demo/src/test/resources/logback.xml
index 554d712..ba86e54 100644
--- a/reference/logging-slf4j-demo/src/main/resources/logback.xml
+++ b/reference/logging-slf4j-demo/src/test/resources/logback.xml
@@ -17,7 +17,7 @@
</appender>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
- <file>${SLF4J_OUTPUT_DIRECTORY}/output.log</file>
+ <file>${TESTNG_SLF4J_OUTPUT_DIRECTORY}/output.log</file>
<encoder>
<pattern>${pattern}</pattern>
</encoder>