diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/resources/log4j2.xml | 152 | ||||
-rw-r--r-- | src/main/scripts/appController.sh | 2 | ||||
-rw-r--r-- | src/main/scripts/docker-entry.sh | 13 |
3 files changed, 153 insertions, 14 deletions
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 |