diff options
author | Luke Parker <lparker@amdocs.com> | 2018-05-22 17:35:18 +1000 |
---|---|---|
committer | Luke Parker <lparker@amdocs.com> | 2018-05-24 16:48:24 +1000 |
commit | 7a724b15b5a1266b8517d56008becd336db6a1c5 (patch) | |
tree | 8db4e6c052cda9fd166dff4270d8271c0bc2d042 /reference/logging-slf4j-demo/README.md | |
parent | bdbcf1dbddd8c4646acd4187bc836102f493a542 (diff) |
Rename slf4j ref impl, add constants
Change-Id: Ib3f24c3aa4974ac8c87fa969613192e884674f00
Issue-ID: LOG-115
Signed-off-by: Luke Parker <lparker@amdocs.com>
Diffstat (limited to 'reference/logging-slf4j-demo/README.md')
-rw-r--r-- | reference/logging-slf4j-demo/README.md | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/reference/logging-slf4j-demo/README.md b/reference/logging-slf4j-demo/README.md new file mode 100644 index 0000000..4434964 --- /dev/null +++ b/reference/logging-slf4j-demo/README.md @@ -0,0 +1,50 @@ +# README - slf4j-reference + +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 +$ java -war target/*war +``` + +The WAR publishes four web services: +1. ```services/alpha``` +2. ```services/beta``` +3. ```services/gamma``` +4. ```services/delta``` + +... each of which can invoke the others. + +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. + +## 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. |