From d8e4e88b6080dfd701ea7aa64d033c38899e77c6 Mon Sep 17 00:00:00 2001 From: wasala Date: Wed, 28 Mar 2018 14:20:58 +0200 Subject: Added logs Improve Dockerfile and build fat jar Change-Id: I8b4dd1a56350af310c70236d6843ae1c357ad95e Issue-ID: DCAEGEN2-407 Signed-off-by: wasala --- Dockerfile | 6 +++--- pom.xml | 20 ++++++++--------- prh-aai-client/pom.xml | 14 ++++++------ prh-app-server/pom.xml | 25 +++++++++++++++------- .../services/prh/tasks/DmaapConsumerTask.java | 19 +++------------- .../dcaegen2/services/prh/tasks/ScheduledTask.java | 2 +- prh-app-server/src/main/resources/logback.xml | 23 ++++++++++++++++++++ prh-dmaap-client/pom.xml | 14 ++++++------ 8 files changed, 68 insertions(+), 55 deletions(-) create mode 100644 prh-app-server/src/main/resources/logback.xml diff --git a/Dockerfile b/Dockerfile index 1c29b2b7..4f1a092c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,13 +3,13 @@ FROM azul/zulu-openjdk:8u152 MAINTAINER Przemysław Wąsala "przemyslaw.wasala@nokia.com" -COPY target/pnf-registration-handler-1.0.0-SNAPSHOT.jar /opt/app/Prh/ +ADD /prh-app-server/target/prh-app-server.jar /opt/app/Prh/ WORKDIR /opt/app/Prh ENV HOME /opt/app/Prh ENV JAVA_HOME /usr #RUN apt-get update && apt-get install -y curl vim -EXPOSE 8080 +EXPOSE 8100 -CMD [ "java", "-jar", "pnf-registration-handler-1.0.0-SNAPSHOT.jar" ] \ No newline at end of file +CMD [ "java", "-jar", "prh-app-server.jar" ] \ No newline at end of file diff --git a/pom.xml b/pom.xml index e334c004..8abf8425 100644 --- a/pom.xml +++ b/pom.xml @@ -398,23 +398,21 @@ - - org.slf4j - slf4j-api - ${slf4j.version} - provided - ch.qos.logback - logback-core + logback-classic ${logback.version} provided - ch.qos.logback - logback-classic - ${logback.version} - provided + org.slf4j + jul-to-slf4j + 1.7.25 + + + org.slf4j + log4j-over-slf4j + 1.7.25 diff --git a/prh-aai-client/pom.xml b/prh-aai-client/pom.xml index 8efa0a35..52d784a9 100644 --- a/prh-aai-client/pom.xml +++ b/prh-aai-client/pom.xml @@ -49,18 +49,16 @@ - org.slf4j - slf4j-api + ch.qos.logback + logback-classic - - ch.qos.logback - logback-core + org.slf4j + jul-to-slf4j - - ch.qos.logback - logback-classic + org.slf4j + log4j-over-slf4j diff --git a/prh-app-server/pom.xml b/prh-app-server/pom.xml index a03e27f3..5a62e40e 100644 --- a/prh-app-server/pom.xml +++ b/prh-app-server/pom.xml @@ -22,6 +22,17 @@ org.springframework.boot spring-boot-maven-plugin + + + + repackage + + + + + prh-app-server + org.onap.dcaegen2.services.prh.MainApp + @@ -39,18 +50,16 @@ - org.slf4j - slf4j-api + ch.qos.logback + logback-classic - - ch.qos.logback - logback-core + org.slf4j + jul-to-slf4j - - ch.qos.logback - logback-classic + org.slf4j + log4j-over-slf4j diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java index 91ed6024..cb2d1331 100644 --- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java @@ -36,24 +36,11 @@ public class DmaapConsumerTask implements DmaapTask { @Override public void execute() { - logger.info("Start task DmaapConsumerTask::execute() :: Execution Time - {}", dateTimeFormatter.format( + logger.debug("Start task DmaapConsumerTask::execute() :: Execution Time - {}", dateTimeFormatter.format( LocalDateTime.now())); //TODO: ADD implementation for executing request to consume topic from dmaap - //DmappConsumerRunner dmappConsumerRunner = consumer.play() - //if(dmappConsumerRunner != null){ - //AAIProcess aaiProcess = new AAiPRocess(dmappConsumerRunner) - /* - try{ - aaiProcess.Execute() - } - catch(Exception e(){ - Log - return - } - DmaapConsumerPost post; - */ - //} - logger.info("End task DmaapConsumerTask::execute() :: Execution Time - {}", + + logger.debug("End task DmaapConsumerTask::execute() :: Execution Time - {}", dateTimeFormatter.format(LocalDateTime.now())); } } \ No newline at end of file diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTask.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTask.java index 5ed3c8c0..a3a48b79 100644 --- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTask.java +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTask.java @@ -48,7 +48,7 @@ public class ScheduledTask { @Scheduled(fixedDelay = SCHEDULING_DELAY) public void scheduledTaskAskingDMaaPOfConsumeEvent() { - logger.info("Task scheduledTaskAskingDMaaPOfConsumeEvent() :: Execution Time - {}", dateTimeFormatter.format( + logger.debug("Task scheduledTaskAskingDMaaPOfConsumeEvent() :: Execution Time - {}", dateTimeFormatter.format( LocalDateTime.now())); try { dmaapConsumerTask.execute(); diff --git a/prh-app-server/src/main/resources/logback.xml b/prh-app-server/src/main/resources/logback.xml new file mode 100644 index 00000000..5f5175e0 --- /dev/null +++ b/prh-app-server/src/main/resources/logback.xml @@ -0,0 +1,23 @@ + + + + + + %d{yyyy-MM-dd HH:mm:ss} | %-5p | [%thread] %logger{5}:%L - %msg%n + + + + + ${LOG_PATH}/logFile.log + true + + %d{yyyy-MM-dd HH:mm:ss} | %-5p | [%thread] %logger{5}:%L - %msg%n + + + + + + + + + \ No newline at end of file diff --git a/prh-dmaap-client/pom.xml b/prh-dmaap-client/pom.xml index e3efc20c..080a6f1b 100644 --- a/prh-dmaap-client/pom.xml +++ b/prh-dmaap-client/pom.xml @@ -47,18 +47,16 @@ - org.slf4j - slf4j-api + ch.qos.logback + logback-classic - - ch.qos.logback - logback-core + org.slf4j + jul-to-slf4j - - ch.qos.logback - logback-classic + org.slf4j + log4j-over-slf4j -- cgit 1.2.3-korg