summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBogumil Zebek <bogumil.zebek@nokia.com>2020-02-21 11:18:26 +0000
committerGerrit Code Review <gerrit@onap.org>2020-02-21 11:18:26 +0000
commit3731f17fd97677d8c426de15241c1310d0947fcf (patch)
treeb4f5e06f9006ac57f5c0b5b11cfa8d5cbae2bbd3
parent0474f5347007cf6c04cb01f84b83fc2edd6fbc59 (diff)
parent7e02d16d8a65c611f45523c51cb26535b1164064 (diff)
Merge "Add of logging for certservice-client"
-rw-r--r--certServiceClient/README.md43
-rw-r--r--certServiceClient/pom.xml20
-rw-r--r--certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClient.java6
-rw-r--r--certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClientApp.java1
-rw-r--r--certServiceClient/src/main/resources/log4j2.xml34
5 files changed, 95 insertions, 9 deletions
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 bd51d73e..c6a17755 100644
--- a/certServiceClient/pom.xml
+++ b/certServiceClient/pom.xml
@@ -131,12 +131,8 @@
<dependencies>
<dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-junit-jupiter</artifactId>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
@@ -151,8 +147,16 @@
<artifactId>junit-jupiter-api</artifactId>
</dependency>
<dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-junit-jupiter</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
</dependencies>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Configuration status="INFO">
+
+ <Appenders>
+ <Console name="CONSOLE" target="SYSTEM_OUT">
+ <PatternLayout
+ pattern="%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} %highlight{${LOG_LEVEL_PATTERN:-%5p}}{FATAL=red blink, ERROR=red, WARN=yellow bold, INFO=green, DEBUG=green bold, TRACE=blue} %style{%pid}{magenta} [%15.15t] %style{%-40.40C{1.}}{cyan} : %m%n%throwable"/>
+ </Console>
+
+ <RollingFile fileName="var/log/onap/aaf/certservice-client/certservice-client.log" filePattern="logs/certservice-client-%d{yyyy-MM-dd}-%i.log" name="ROLLING_FILE">
+ <PatternLayout pattern="[%d{ISO8601}][%-5p][%-5c] %m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="64 MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="10"/>
+ </RollingFile>
+
+ </Appenders>
+
+ <Loggers>
+
+ <Logger name="reactor.netty" level="WARN"/>
+ <Logger name="reactor.netty.tcp.TcpServer" level="OFF"/>
+ <Logger name="io.netty" level="INFO"/>
+ <Logger name="io.netty.util" level="WARN"/>
+
+ <Root level="DEBUG">
+ <AppenderRef ref="CONSOLE"/>
+ <AppenderRef ref="ROLLING_FILE"/>
+ </Root>
+
+ </Loggers>
+</Configuration> \ No newline at end of file