From 7e02d16d8a65c611f45523c51cb26535b1164064 Mon Sep 17 00:00:00 2001 From: kjaniak Date: Tue, 18 Feb 2020 16:13:54 +0100 Subject: Add of logging for certservice-client Issue-ID: AAF-996 Signed-off-by: kjaniak Change-Id: I8bed44937da32fff863df724adc023f546b5e12e --- certServiceClient/README.md | 43 ++++++++++++++++++++++ certServiceClient/pom.xml | 20 ++++++---- .../aaf/certservice/client/CertServiceClient.java | 6 +++ .../certservice/client/CertServiceClientApp.java | 1 - certServiceClient/src/main/resources/log4j2.xml | 34 +++++++++++++++++ 5 files changed, 95 insertions(+), 9 deletions(-) create mode 100644 certServiceClient/README.md create mode 100644 certServiceClient/src/main/resources/log4j2.xml diff --git a/certServiceClient/README.md b/certServiceClient/README.md new file mode 100644 index 00000000..c1d56ad7 --- /dev/null +++ b/certServiceClient/README.md @@ -0,0 +1,43 @@ +# Cert service client + +### Project building +``` +mvn clean package +``` + +### Building Docker image manually +Go to the certServiceClient subfolder and execute following statement (1.0.0-SNAPSHOT is related to a current project.version parameter): +``` +docker build --build-arg VERSION=1.0.0-SNAPSHOT -t onap/org.onap.aaf.certservice.aaf-certservice-client . +``` + +### Install the package into the local repository +``` +mvn clean install +``` + +### Building Docker image and install the package into the local repository +``` +mvn clean install -P docker +``` + +### Running Docker container local +``` +docker run --name aaf-certservice-client onap/org.onap.aaf.certservice.aaf-certservice-client +``` + +### Running Docker container from nexus +``` +docker run --name aaf-certservice-client nexus3.onap.org:10001/onap/org.onap.aaf.certservice.aaf-certservice-client:1.0.0 +``` + +### Logs locally + +path: +``` +var/log/onap/aaf/certservice-client/certservice-client.log +``` +### Logs in Docker container +``` +docker logs aaf-certservice-client +``` \ No newline at end of file diff --git a/certServiceClient/pom.xml b/certServiceClient/pom.xml index f32501bf..d78eacd6 100644 --- a/certServiceClient/pom.xml +++ b/certServiceClient/pom.xml @@ -131,12 +131,8 @@ - org.mockito - mockito-core - - - org.mockito - mockito-junit-jupiter + org.assertj + assertj-core org.slf4j @@ -151,8 +147,16 @@ junit-jupiter-api - org.assertj - assertj-core + org.mockito + mockito-core + + + org.mockito + mockito-junit-jupiter + + + org.springframework.boot + spring-boot-starter-log4j2 diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClient.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClient.java index 4416d0ec..6e83a40e 100644 --- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClient.java +++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClient.java @@ -19,12 +19,18 @@ package org.onap.aaf.certservice.client; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + public class CertServiceClient { + private static final Logger LOGGER = LoggerFactory.getLogger(CertServiceClient.class); + public void run(String[] args) { exit(0); } protected void exit(int statusCode){ + LOGGER.debug("Application exits with following exit code: " + statusCode); System.exit(statusCode); } } diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClientApp.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClientApp.java index b0490e88..adbb02ad 100644 --- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClientApp.java +++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClientApp.java @@ -25,5 +25,4 @@ public class CertServiceClientApp { CertServiceClient certServiceClient = new CertServiceClient(); certServiceClient.run(args); } - } \ No newline at end of file diff --git a/certServiceClient/src/main/resources/log4j2.xml b/certServiceClient/src/main/resources/log4j2.xml new file mode 100644 index 00000000..37eb078b --- /dev/null +++ b/certServiceClient/src/main/resources/log4j2.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit 1.2.3-korg