diff options
author | Michael O'Brien <frank.obrien@amdocs.com> | 2018-05-15 15:11:44 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-05-15 15:11:44 +0000 |
commit | 8961354d79b56d1b1285f2ccdf5f78f1db8f9305 (patch) | |
tree | 07591c43f6e8055d9952cf2b7f61d32fc62c94e6 /reference/slf4j-reference/README.md | |
parent | 741575ff053d71ec54429837854d44237db6eb72 (diff) | |
parent | abbbaf088ace3917f6cd7839279bd07816e94f80 (diff) |
Merge "SLF4J adapter (in 'common') + call graph demo"
Diffstat (limited to 'reference/slf4j-reference/README.md')
-rw-r--r-- | reference/slf4j-reference/README.md | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/reference/slf4j-reference/README.md b/reference/slf4j-reference/README.md new file mode 100644 index 0000000..4434964 --- /dev/null +++ b/reference/slf4j-reference/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. |