summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/log4j.xml173
-rw-r--r--etc/logrotate.conf7
-rw-r--r--pom.xml7
-rw-r--r--src/main/resources/log4j2.xml152
-rw-r--r--src/main/scripts/appController.sh2
-rw-r--r--src/main/scripts/docker-entry.sh13
6 files changed, 156 insertions, 198 deletions
diff --git a/etc/log4j.xml b/etc/log4j.xml
deleted file mode 100644
index aa836eb1..00000000
--- a/etc/log4j.xml
+++ /dev/null
@@ -1,173 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<!--
-================================================================================
-Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved.
-================================================================================
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-============LICENSE_END=========================================================
-
-ECOMP is a trademark and service mark of AT&T Intellectual Property.
--->
-
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
-
- <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
- <param name="threshold" value="INFO" />
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="[%d{ISO8601}][%-5p][%-10t][%c] - %m%n"/>
- </layout>
- </appender>
-
- <appender name="IFILE" class="org.apache.log4j.RollingFileAppender">
- <param name="threshold" value="INFO" />
- <param name="File" value="logs/input.log" />
- <param name="MaxFileSize" value="32MB"/>
- <param name="MaxBackupIndex" value="10"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="[%d{ISO8601}][%-5p][%-10t][%-5c]%m%n" />
- </layout>
- </appender>
-
- <appender name="OFILE" class="org.apache.log4j.RollingFileAppender">
- <param name="threshold" value="INFO" />
- <param name="File" value="logs/output.log" />
- <param name="MaxFileSize" value="32MB"/>
- <param name="MaxBackupIndex" value="10"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="[%d{ISO8601}][%-5p][%-10t][%-5c]%m%n" />
- </layout>
- </appender>
-
- <appender name="EFILE" class="org.apache.log4j.RollingFileAppender">
- <param name="threshold" value="INFO" />
- <param name="File" value="logs/error.log" />
- <param name="MaxFileSize" value="32MB"/>
- <param name="MaxBackupIndex" value="5"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="[%d{ISO8601}][%-5p][%-10t][%-5c]%m%n" />
- </layout>
- </appender>
-
- <!--
- ECOMP logging setup
-
- NOTES:
-
- 1. files are written to "./logs/<filename>". You must setup the environment
- so that ./logs is a symlink to the correct location according to the ECOMP
- log standard. For example, "/opt/logs/DCAE/highlandParkVcScope". If that's
- not possible, change the File setting in each appender appropriately.
- -->
- <appender name="ECOMP_AUDIT" class="org.apache.log4j.RollingFileAppender">
- <param name="threshold" value="DEBUG" />
- <param name="File" value="./logs/ecomp/audit.log" />
- <param name="MaxFileSize" value="128MB"/>
- <param name="MaxBackupIndex" value="20"/>
- <layout class="com.att.nsa.logging.log4j.EcompLayout"><param name="ConversionPattern" value="ECOMP_AUDIT" /></layout>
- </appender>
-
- <appender name="ECOMP_METRIC" class="org.apache.log4j.RollingFileAppender">
- <param name="threshold" value="INFO" />
- <param name="File" value="./logs/ecomp/metric.log" />
- <param name="MaxFileSize" value="128MB"/>
- <param name="MaxBackupIndex" value="10"/>
- <layout class="com.att.nsa.logging.log4j.EcompLayout"><param name="ConversionPattern" value="ECOMP_METRIC" /></layout>
- </appender>
-
- <appender name="ECOMP_ERROR" class="org.apache.log4j.RollingFileAppender">
- <param name="threshold" value="WARN" /> <!-- only WARN and ERROR are allowed in this log -->
- <param name="File" value="./logs/ecomp/error.log" />
- <param name="MaxFileSize" value="128MB"/>
- <param name="MaxBackupIndex" value="10"/>
- <layout class="com.att.nsa.logging.log4j.EcompLayout"><param name="ConversionPattern" value="ECOMP_ERROR" /></layout>
- </appender>
-
- <appender name="ECOMP_DEBUG" class="org.apache.log4j.RollingFileAppender">
- <param name="threshold" value="DEBUG" />
- <param name="File" value="./logs/ecomp/debug.log" />
- <param name="MaxFileSize" value="128MB"/>
- <param name="MaxBackupIndex" value="20"/>
- <layout class="com.att.nsa.logging.log4j.EcompLayout"><param name="ConversionPattern" value="ECOMP_DEBUG" /></layout>
- </appender>
-
- <logger name="org.onap.dcae.common.input" additivity="false">
- <level value="INFO"/>
- <appender-ref ref="IFILE"/>
- </logger>
-
- <logger name="org.onap.dcae.common.output" additivity="false">
- <level value="INFO"/>
- <appender-ref ref="CONSOLE" />
- <appender-ref ref="OFILE"/>
- </logger>
-
- <logger name="org.onap.dcae.common.error" additivity="false">
- <level value="DEBUG"/>
- <appender-ref ref="EFILE"/>
- <appender-ref ref="CONSOLE" />
- <appender-ref ref="ECOMP_ERROR" />
- </logger>
-
- <!--
- The ECOMP logging standard has four specific classes of logging that are
- unrelated to subsystem logger names. If you want them activated, uncomment
- this block.
- -->
- <logger name="com.att.ecomp.audit" additivity="false">
- <level value="info"/>
- <appender-ref ref="CONSOLE" />
- <appender-ref ref="ECOMP_AUDIT" />
- </logger>
-
- <logger name="com.att.ecomp.metrics" additivity="false">
- <level value="info"/>
- <appender-ref ref="ECOMP_METRIC" />
- </logger>
-
- <logger name="com.att.ecomp.error" additivity="false">
- <level value="info"/>
- <appender-ref ref="ECOMP_ERROR" />
- </logger>
-
- <logger name="com.att.ecomp.debug" additivity="false">
- <level value="info"/>
- <appender-ref ref="ECOMP_DEBUG" />
- </logger>
-
- <logger name="org.onap.dcae.common.EventPublisher" additivity="false">
- <level value="debug"/>
- <appender-ref ref="CONSOLE" />
- </logger>
-
- <logger name="com.att.nsa.apiClient.http.HttpClient" additivity="false">
- <level value="info"/>
- <appender-ref ref="CONSOLE" />
- </logger>
-
- <logger name="com.att.nsa.cambria.client.impl.CambriaSimplerBatchPublisher" additivity="false">
- <level value="info"/>
- <appender-ref ref="CONSOLE" />
- </logger>
-
- <root>
- <level value="DEBUG" />
- <appender-ref ref="CONSOLE" />
- <appender-ref ref="ECOMP_AUDIT" />
- <appender-ref ref="ECOMP_DEBUG" />
- <appender-ref ref="ECOMP_ERROR" />
- </root>
-
-</log4j:configuration>
diff --git a/etc/logrotate.conf b/etc/logrotate.conf
deleted file mode 100644
index 41bf4edc..00000000
--- a/etc/logrotate.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-/opt/app/VESCollector/logs/collector.log {
- size 64M
- rotate 10
- copytruncate
- dateext
- dateformat .%Y-%m-%dT%H:%M:%S
-} \ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 677736f5..735f7a39 100644
--- a/pom.xml
+++ b/pom.xml
@@ -160,8 +160,7 @@
<runs>
<!-- Maven is loosing file permissions during artifacts copy -->
<run>chmod +x bin/*.sh</run>
- <run><![CDATA[apt-get update && apt-get install -y --no-install-recommends logrotate procps && apt-get install -y vim && apt-get install -y curl && apt-get clean all]]></run>
- <run>chmod 0644 etc/logrotate.conf</run>
+ <run><![CDATA[apt-get update && apt-get install -y --no-install-recommends procps && apt-get install -y vim && apt-get install -y curl && apt-get clean all]]></run>
</runs>
<exposes>
<expose>8080</expose>
@@ -342,8 +341,8 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-log4j</artifactId>
- <version>1.3.8.RELEASE</version>
+ <artifactId>spring-boot-starter-log4j2</artifactId>
+ <version>2.1.5.RELEASE</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
new file mode 100644
index 00000000..649441d7
--- /dev/null
+++ b/src/main/resources/log4j2.xml
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Configuration status="INFO">
+
+ <Appenders>
+
+ <Console name="CONSOLE" target="SYSTEM_OUT" >
+ <LevelRangeFilter maxLevel="INFO" minLevel="ERROR"/>
+ <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{${sys:PID}}{magenta} [%15.15t] %style{%-40.40C{1.}}{cyan} : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>
+ </Console>
+
+ <RollingFile fileName="logs/collector.log" filePattern="logs/collector-%d{yyyy-MM-dd}-%i.log" name="ROL_CONSOLE">
+ <LevelRangeFilter maxLevel="INFO" minLevel="ERROR"/>
+ <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p %m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="64 MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="10"/>
+ </RollingFile>
+
+ <RollingFile fileName="logs/input.log" filePattern="logs/input-%d{yyyy-MM-dd}-%i.log" name="IFILE">
+ <LevelRangeFilter maxLevel="INFO" minLevel="INFO"/>
+ <PatternLayout pattern="[%d{ISO8601}][%-5p][%-10t][%-5c]%m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="32 MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="10"/>
+ </RollingFile>
+
+ <RollingFile fileName="logs/output.log" filePattern="logs/output-%d{yyyy-MM-dd}-%i.log" name="OFILE">
+ <LevelRangeFilter maxLevel="INFO" minLevel="INFO"/>
+ <PatternLayout pattern="[%d{ISO8601}][%-5p][%-10t][%-5c]%m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="32 MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="10"/>
+ </RollingFile>
+
+ <RollingFile fileName="logs/error.log" filePattern="logs/error-%d{yyyy-MM-dd}-%i.log" name="EFILE">
+ <LevelRangeFilter maxLevel="INFO" minLevel="INFO"/>
+ <PatternLayout pattern="[%d{ISO8601}][%-5p][%-10t][%-5c]%m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="64 MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="10"/>
+ </RollingFile>
+
+ <RollingFile fileName="logs/eelf/audit.log" filePattern="logs/eelf/audit-%d{yyyy-MM-dd}-%i.log" name="EELF_AUDIT">
+ <LevelRangeFilter maxLevel="DEBUG" minLevel="INFO"/>
+ <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p %m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="64 MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="20"/>
+ </RollingFile>
+
+ <RollingFile fileName="logs/eelf/metric.log" filePattern="logs/eelf/metric-%d{yyyy-MM-dd}-%i.log" name="EELF_METRIC">
+ <LevelRangeFilter maxLevel="INFO" minLevel="INFO"/>
+ <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p %m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="64 MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="20"/>
+ </RollingFile>
+
+
+ <RollingFile fileName="logs/eelf/error.log" filePattern="logs/eelf/error-%d{yyyy-MM-dd}-%i.log" name="EELF_ERROR">
+ <LevelRangeFilter maxLevel="WARN" minLevel="WARN"/>
+ <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p %m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="64 MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="20"/>
+ </RollingFile>
+
+
+ <RollingFile fileName="logs/eelf/debug.log" filePattern="logs/eelf/debug-%d{yyyy-MM-dd}-%i.log" name="EELF_DEBUG">
+ <LevelRangeFilter maxLevel="DEBUG" minLevel="DEBUG"/>
+ <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p %m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="64 MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="20"/>
+ </RollingFile>
+
+ </Appenders>
+
+ <Loggers>
+
+ <Logger additivity="false" level="info" name="org.onap.dcae.common.input">
+ <AppenderRef ref="IFILE"/>
+ </Logger>
+
+ <Logger additivity="false" level="info" name="org.onap.dcae.common.output">
+ <AppenderRef ref="CONSOLE"/>
+ <AppenderRef ref="OFILE"/>
+ </Logger>
+
+ <Logger additivity="false" level="debug" name="org.onap.dcae.common.error">
+ <AppenderRef ref="EFILE"/>
+ <AppenderRef ref="CONSOLE"/>
+ <AppenderRef ref="EELF_ERROR"/>
+ </Logger>
+
+ <!--NOT USED-->
+ <Logger additivity="false" level="info" name="com.att.ecomp.audit">
+ <AppenderRef ref="CONSOLE"/>
+ <AppenderRef ref="EELF_AUDIT"/>
+ </Logger>
+
+ <Logger additivity="false" level="info" name="com.att.ecomp.metrics">
+ <AppenderRef ref="EELF_METRIC"/>
+ </Logger>
+
+ <!--NOT USED-->
+ <Logger additivity="false" level="info" name="com.att.ecomp.error">
+ <AppenderRef ref="EELF_ERROR"/>
+ </Logger>
+
+ <!--NOT USED-->
+ <Logger additivity="false" level="info" name="com.att.ecomp.debug">
+ <AppenderRef ref="EELF_DEBUG"/>
+ </Logger>
+
+ <!--NOT USED-->
+ <Logger additivity="false" level="debug" name="org.onap.dcae.common.EventPublisher">
+ <AppenderRef ref="CONSOLE"/>
+ </Logger>
+
+ <!--NOT USED-->
+ <Logger additivity="false" level="info" name="com.att.nsa.apiClient.http.HttpClient">
+ <AppenderRef ref="CONSOLE"/>
+ </Logger>
+
+ <!--NOT USED-->
+ <Logger additivity="false" level="info"
+ name="com.att.nsa.cambria.client.impl.CambriaSimplerBatchPublisher">
+ <AppenderRef ref="CONSOLE"/>
+ </Logger>
+
+ <Root additivity="false" level="debug">
+ <AppenderRef ref="CONSOLE"/>
+ <AppenderRef ref="ROL_CONSOLE"/>
+ <AppenderRef ref="EELF_AUDIT"/>
+ <AppenderRef ref="EELF_DEBUG"/>
+ <AppenderRef ref="EELF_ERROR"/>
+ </Root>
+
+ </Loggers>
+
+</Configuration>
diff --git a/src/main/scripts/appController.sh b/src/main/scripts/appController.sh
index f5094dcc..bdb2c812 100644
--- a/src/main/scripts/appController.sh
+++ b/src/main/scripts/appController.sh
@@ -35,7 +35,7 @@ start() {
-XX:ErrorFile=logs/java_error%p.log \
-XX:+HeapDumpOnOutOfMemoryError \
-Dhttps.protocols=TLSv1.1,TLSv1.2 \
- org.onap.dcae.VesApplication $* &>> logs/collector.log &
+ org.onap.dcae.VesApplication $* &
}
stop() {
diff --git a/src/main/scripts/docker-entry.sh b/src/main/scripts/docker-entry.sh
index 6b300669..3131a1a6 100644
--- a/src/main/scripts/docker-entry.sh
+++ b/src/main/scripts/docker-entry.sh
@@ -21,19 +21,6 @@
###
source bin/logger.sh
-# Redirect all stdout & stderr to a main log file, but also let it print into the console
-# At the time this script is invoked, these directories and files do not exist yet, so we need to create them
-mkdir -p logs
-touch logs/collector.log
-exec &> >(tee -a logs/collector.log)
-
-log "Enabling log rotation for collector.log"
-loggedCommand "cp etc/logrotate.conf /etc/logrotate.d"
-echo "* * * * * root logrotate /etc/logrotate.conf" >> /etc/crontab
-log "Restarting cron"
-loggedCommand "service cron reload"
-loggedCommand "service cron start"
-
log "Main application entry-point invoked"
if [ ! -z ${COLLECTOR_IP} ]; then