From 72eaec3eaa5c6496c40842b45b81fcb04a8ec50a Mon Sep 17 00:00:00 2001 From: kurczews Date: Mon, 5 Nov 2018 12:42:15 +0100 Subject: Move logback config from WAR Issue-ID: VID-40 Change-Id: I8c658e78af0e5b045e9fb36f4da07f0c5bb0f097 Signed-off-by: kurczews --- deliveries/src/main/docker/docker-files/Dockerfile | 9 +- .../main/docker/docker-files/conf.d/logback.xml | 371 +++++++++++++++++++++ .../docker-files/conf.d/logback_template.xml | 341 +++++++++++++++++++ deliveries/src/main/scripts/localize_logback.sh | 5 +- deliveries/src/main/scripts/localize_war.sh | 2 +- epsdk-app-onap/src/main/resources/logback.xml | 371 --------------------- .../src/main/resources/logback_template.xml | 341 ------------------- 7 files changed, 721 insertions(+), 719 deletions(-) create mode 100755 deliveries/src/main/docker/docker-files/conf.d/logback.xml create mode 100755 deliveries/src/main/docker/docker-files/conf.d/logback_template.xml delete mode 100755 epsdk-app-onap/src/main/resources/logback.xml delete mode 100755 epsdk-app-onap/src/main/resources/logback_template.xml diff --git a/deliveries/src/main/docker/docker-files/Dockerfile b/deliveries/src/main/docker/docker-files/Dockerfile index 8cd2bc7aa..4b04e22cf 100755 --- a/deliveries/src/main/docker/docker-files/Dockerfile +++ b/deliveries/src/main/docker/docker-files/Dockerfile @@ -1,13 +1,14 @@ FROM tomcat:8.0-jre8 + # add vim and uncomment alias to speedup troubleshooting purpose RUN apt-get update && apt-get install -y \ openjdk-8-jdk vim net-tools -RUN sed -i 's/# alias/alias/g' /root/.bashrc +COPY conf.d/ /etc/onap/vid/conf.d/ -RUN mkdir -p ${ROOT_DIR}/etc +RUN sed -i 's/# alias/alias/g' /root/.bashrc -ENV JAVA_OPTS="-Xmx1536m -Xms1536m" +ENV JAVA_OPTS="-Xmx1536m -Xms1536m -Dlogback.configurationFile=/etc/onap/vid/conf.d/logback.xml" ENV ROOT_DIR /opt/app/vid @@ -87,4 +88,4 @@ ADD maven/artifacts/vid.war /tmp/vid/stage/ RUN chmod +x /tmp/vid/localize.sh -CMD ["/tmp/vid/localize.sh"] +CMD ["/tmp/vid/localize.sh"] \ No newline at end of file diff --git a/deliveries/src/main/docker/docker-files/conf.d/logback.xml b/deliveries/src/main/docker/docker-files/conf.d/logback.xml new file mode 100755 index 000000000..09d241456 --- /dev/null +++ b/deliveries/src/main/docker/docker-files/conf.d/logback.xml @@ -0,0 +1,371 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${defaultLoggerPattern} + + + + + + + + + + + + ${logDirectory}/${generalLogName}.log + + + ${logDirectory}/${generalLogName}.%d{yyyy-MM-dd}.log.zip + + + 30 + 3GB + + + + ${applicationLoggerPattern} + + + + + + 256 + + true + + + + + + + + + + + + + + + + + + + ${logDirectory}/${auditLogName}.log + + + ${logDirectory}/${auditLogName}.%d{yyyy-MM-dd}.log.zip + + + 30 + 3GB + + + + ${auditLoggerPattern} + + + + 256 + + + + + ${logDirectory}/${metricsLogName}.log + + + ${logDirectory}/${metricsLogName}.%d{yyyy-MM-dd}.log.zip + + + 30 + 3GB + + + + ${metricsLoggerPattern} + + + + + + 256 + + + + + ${logDirectory}/${errorLogName}.log + + + ${logDirectory}/${errorLogName}.%d{yyyy-MM-dd}.log.zip + + + 30 + 3GB + + + + ${errorLoggerPattern} + + + + + 256 + + + + + ${debugLogDirectory}/${debugLogName}.log + + + ${logDirectory}/${debugLogName}.%d{yyyy-MM-dd}.log.zip + + + 30 + 3GB + + + + ${defaultLoggerPattern} + + + + + 256 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/deliveries/src/main/docker/docker-files/conf.d/logback_template.xml b/deliveries/src/main/docker/docker-files/conf.d/logback_template.xml new file mode 100755 index 000000000..bbc58cf2f --- /dev/null +++ b/deliveries/src/main/docker/docker-files/conf.d/logback_template.xml @@ -0,0 +1,341 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${defaultPattern} + + + + + + + + + + + + ${logDirectory}/${generalLogName}.log + + ${logDirectory}/${generalLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${defaultPattern} + + + + + + 256 + + + + + + + + + + + + + + + + + + + ${logDirectory}/${auditLogName}.log + + ${logDirectory}/${auditLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${defaultPattern} + + + + 256 + + + + + ${logDirectory}/${metricsLogName}.log + + ${logDirectory}/${metricsLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + + ${defaultPattern} + + + + + + 256 + + + + + ${logDirectory}/${errorLogName}.log + + ${logDirectory}/${errorLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${defaultPattern} + + + + + 256 + + + + + ${debugLogDirectory}/${debugLogName}.log + + ${debugLogDirectory}/${debugLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${debugLoggerPattern} + + + + + 256 + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/deliveries/src/main/scripts/localize_logback.sh b/deliveries/src/main/scripts/localize_logback.sh index a0f177337..90ce883cc 100755 --- a/deliveries/src/main/scripts/localize_logback.sh +++ b/deliveries/src/main/scripts/localize_logback.sh @@ -1,7 +1,8 @@ #!/bin/bash -FINAL_CONFIG_FILE=$1/classes/logback.xml -TEMPLATE_CONFIG_FILE=$1/classes/logback_template.xml +BASE_DIR=/etc/onap/vid/conf.d +FINAL_CONFIG_FILE=${BASE_DIR}/logback.xml +TEMPLATE_CONFIG_FILE=${BASE_DIR}/logback_template.xml echo "Localizing the VID logback configuration" diff --git a/deliveries/src/main/scripts/localize_war.sh b/deliveries/src/main/scripts/localize_war.sh index 99cb177ed..53a928e84 100755 --- a/deliveries/src/main/scripts/localize_war.sh +++ b/deliveries/src/main/scripts/localize_war.sh @@ -1,6 +1,6 @@ #!/bin/bash -source /tmp/vid/localize_logback.sh $1 || { +source /tmp/vid/localize_logback.sh || { echo "ERROR: Localizing logback.xml failed" exit 1 } diff --git a/epsdk-app-onap/src/main/resources/logback.xml b/epsdk-app-onap/src/main/resources/logback.xml deleted file mode 100755 index 14b534da6..000000000 --- a/epsdk-app-onap/src/main/resources/logback.xml +++ /dev/null @@ -1,371 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${defaultLoggerPattern} - - - - - - - - - - - - ${logDirectory}/${generalLogName}.log - - - ${logDirectory}/${generalLogName}.%d{yyyy-MM-dd}.log.zip - - - 30 - 3GB - - - - ${applicationLoggerPattern} - - - - - - 256 - - true - - - - - - - - - - - - - - - - - - - ${logDirectory}/${auditLogName}.log - - - ${logDirectory}/${auditLogName}.%d{yyyy-MM-dd}.log.zip - - - 30 - 3GB - - - - ${auditLoggerPattern} - - - - 256 - - - - - ${logDirectory}/${metricsLogName}.log - - - ${logDirectory}/${metricsLogName}.%d{yyyy-MM-dd}.log.zip - - - 30 - 3GB - - - - ${metricsLoggerPattern} - - - - - - 256 - - - - - ${logDirectory}/${errorLogName}.log - - - ${logDirectory}/${errorLogName}.%d{yyyy-MM-dd}.log.zip - - - 30 - 3GB - - - - ${errorLoggerPattern} - - - - - 256 - - - - - ${debugLogDirectory}/${debugLogName}.log - - - ${logDirectory}/${debugLogName}.%d{yyyy-MM-dd}.log.zip - - - 30 - 3GB - - - - ${defaultLoggerPattern} - - - - - 256 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/epsdk-app-onap/src/main/resources/logback_template.xml b/epsdk-app-onap/src/main/resources/logback_template.xml deleted file mode 100755 index 8753dd8e9..000000000 --- a/epsdk-app-onap/src/main/resources/logback_template.xml +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${defaultPattern} - - - - - - - - - - - - ${logDirectory}/${generalLogName}.log - - ${logDirectory}/${generalLogName}.%i.log.zip - - 1 - 9 - - - 5MB - - - ${defaultPattern} - - - - - - 256 - - - - - - - - - - - - - - - - - - - ${logDirectory}/${auditLogName}.log - - ${logDirectory}/${auditLogName}.%i.log.zip - - 1 - 9 - - - 5MB - - - ${defaultPattern} - - - - 256 - - - - - ${logDirectory}/${metricsLogName}.log - - ${logDirectory}/${metricsLogName}.%i.log.zip - - 1 - 9 - - - 5MB - - - - ${defaultPattern} - - - - - - 256 - - - - - ${logDirectory}/${errorLogName}.log - - ${logDirectory}/${errorLogName}.%i.log.zip - - 1 - 9 - - - 5MB - - - ${defaultPattern} - - - - - 256 - - - - - ${debugLogDirectory}/${debugLogName}.log - - ${debugLogDirectory}/${debugLogName}.%i.log.zip - - 1 - 9 - - - 5MB - - - ${debugLoggerPattern} - - - - - 256 - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit 1.2.3-korg