1 # README - slf4j-reference
3 This project gives an example of ONAP-compliant logging using SLF4J logging.
7 In ```org.onap.logging.ref.slf4j.common```, there are TWO classes:
8 1. ```org.onap.logging.ref.slf4j.common.ONAPLogConstants```, providing declarations of standard ONAP Markers, MDCs and HTTP headers.
9 2. ```org.onap.logging.ref.slf4j.common.ONAPLogAdapter```, providing a lightweight, compliant implementation of the ONAP logging spec.
12 1. A loosely-coupled SLF4j logging wrapper:
13 * To be used for logging ONAP ```entry```, ```exit``` and ```invoke``` behavior.
14 * Devolving all *application* logging to the component, via the regular SLF4J ```Logger``` facade.
15 2. Customization options:
16 * *Cheap*, by way of bean properties. This is suited to most Use Cases.
18 * By OPTIONALLY implementing one of a number of adapters:
19 * ```RequestAdapter``` to read incoming headers.
20 * ```ServiceDescriptor``` for reporting attributes of the current service.
21 * ```ResponseDescriptor``` for reporting outcomes.
22 * ```RequestBuilder``` for setting southbound request headers.
23 * By OPTIONALLY overriding methods like ```ONAPLogAdapter#setMDCs(RequestAdapter)```.
26 * The adapter implementation uses static inner classes in order to fit in a single source file. This was an objective.
30 Building produces a simple (spring-boot](https://projects.spring.io/spring-boot/) example WAR, which can be launched from this directory with:
33 $ java -war target/*war
36 The WAR publishes four web services:
37 1. ```services/alpha```
38 2. ```services/beta```
39 3. ```services/gamma```
40 4. ```services/delta```
42 ... each of which can invoke the others.
44 The purpose of this WAR is to demonstrate minimalist ONAP-compliant logging for web components, but a secondary purpose is to demonstrate that the call graph can be generated for a (mostly) representative set of interacting REST services.
49 1. Code in the (potentially) reusable ``common`` package.
50 2. Validating that emitted logs can be used to generate an unambiguous call graph.