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 +- 5 files changed, 721 insertions(+), 7 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 (limited to 'deliveries') diff --git a/deliveries/src/main/docker/docker-files/Dockerfile b/deliveries/src/main/docker/docker-files/Dockerfile index 8cd2bc7a..4b04e22c 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 00000000..09d24145 --- /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 00000000..bbc58cf2 --- /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 a0f17733..90ce883c 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 99cb177e..53a928e8 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 } -- cgit 1.2.3-korg