summaryrefslogtreecommitdiffstats
path: root/integrity-audit/src/test
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2019-12-04 10:24:58 +0000
committerliamfallon <liam.fallon@est.tech>2019-12-06 15:23:38 +0000
commit3073f50c525e47b0f0c4343330a9456faabeae78 (patch)
tree9061d3e2db3e1da2641af5509f82617b0bb35ca1 /integrity-audit/src/test
parentc2dc5169d9cb7941939ba1fd65afcf14d515386b (diff)
Minor changes for new Eclipse checkstyle checks
The laest Eclipse checkstyle version 8.26.0 does more thorough checking and identified a number of small issues in the apex-pdp codebase. This review fixes those issues. logging pattern in logback.xml files amended to be less than 120 characters. Test case added for checking parameter is valid. Issue-ID: POLICY-2204 Change-Id: Id7293e44b56c225afc6290e1c599603e9ebedb19 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'integrity-audit/src/test')
-rw-r--r--integrity-audit/src/test/java/org/onap/policy/common/ia/DefaultLoggingPatternTest.java102
-rw-r--r--integrity-audit/src/test/resources/logback-test.xml279
-rw-r--r--integrity-audit/src/test/resources/logback.xml323
-rw-r--r--integrity-audit/src/test/resources/logger-test.expectedlog1
-rw-r--r--integrity-audit/src/test/resources/policyLogger.properties13
-rw-r--r--integrity-audit/src/test/resources/xlogger-test.expectedlog1
6 files changed, 483 insertions, 236 deletions
diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/DefaultLoggingPatternTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/DefaultLoggingPatternTest.java
new file mode 100644
index 00000000..959a4e7c
--- /dev/null
+++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/DefaultLoggingPatternTest.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.common.ia;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.junit.AfterClass;
+import org.junit.Test;
+import org.onap.policy.common.utils.resources.TextFileUtils;
+import org.slf4j.Logger;
+import org.slf4j.MDC;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * Test the default logging pattern.
+ *
+ */
+public class DefaultLoggingPatternTest {
+ // XLogger for this class
+ private static final XLogger XLOGGER = XLoggerFactory.getXLogger(DefaultLoggingPatternTest.class);
+
+ // Logger for this class
+ private static final Logger LOGGER = XLoggerFactory.getXLogger(DefaultLoggingPatternTest.class);
+
+ /**
+ * Delete logging file after test.
+ */
+ @AfterClass
+ public static void deleteLogFile() {
+ new File("testingLogs/common-modules/integrity-audit/logging-pattern-test.log").deleteOnExit();
+ }
+
+ /**
+ * Test XLogger output.
+ *
+ * @throws IOException on errors
+ */
+ @Test
+ public void testDefaultLoggingPatternXLogger() throws IOException {
+ testDefaultLoggingPattern(XLOGGER, "xlogger");
+ }
+
+ /**
+ * Test Logger output.
+ *
+ * @throws IOException on errors
+ */
+ @Test
+ public void testDefaultLoggingPatternLogger() throws IOException {
+ testDefaultLoggingPattern(LOGGER, "logger");
+ }
+
+ /**
+ * Test Logger output.
+ *
+ * @throws IOException on errors
+ */
+ public void testDefaultLoggingPattern(final Logger logger, final String loggerString) throws IOException {
+ MDC.put("requestId", "TheRequestId");
+ MDC.put("serviceInstanceId", "TheServiceInstanceId");
+ MDC.put("serverName", "TheServerName");
+ MDC.put("serviceName", "TheServiceName");
+ MDC.put("instanceUuid", "TheInstanceUuid");
+ MDC.put("severity", "TheSeverity");
+ MDC.put("serverIpAddress", "TheServerIpAddress");
+ MDC.put("server", "TheServer");
+ MDC.put("clientIpAddress", "TheClientIpAddress");
+
+ logger.info("This is a test logging string for {}", loggerString);
+
+ // Jump past the date, and the actual and expected logged strings should be the same
+ String actualLoggedString =
+ TextFileUtils.getTextFileAsString("testingLogs/common-modules/integrity-audit/logging-pattern-test.log")
+ .substring(23);
+ String expectedLoggedString = TextFileUtils
+ .getTextFileAsString("src/test/resources/" + loggerString + "-test.expectedlog").substring(23);
+
+ assertThat(actualLoggedString).contains(expectedLoggedString);
+ }
+}
diff --git a/integrity-audit/src/test/resources/logback-test.xml b/integrity-audit/src/test/resources/logback-test.xml
index f4c656c7..e3867e79 100644
--- a/integrity-audit/src/test/resources/logback-test.xml
+++ b/integrity-audit/src/test/resources/logback-test.xml
@@ -20,40 +20,79 @@
<!-- Controls the output of logs for JUnit tests -->
-<configuration scan="false" debug="true">
+<configuration
+ scan="false"
+ debug="true">
<!--<jmxConfigurator /> -->
<!-- directory path for all other type logs -->
- <property name="logDir" value="testingLogs" />
+ <property
+ name="logDir"
+ value="testingLogs" />
<!-- directory path for debugging type logs -->
- <property name="debugDir" value="testingLogs" />
+ <property
+ name="debugDir"
+ value="testingLogs" />
<!-- specify the component name
<ONAP-component-name>::= "MSO" | "DCAE" | "ASDC " | "AAI" |"Policy" | "SDNC" | "AC" -->
- <property name="componentName" value="common-modules"></property>
- <property name="subComponentName" value="integrity-audit"></property>
+ <property
+ name="componentName"
+ value="common-modules"></property>
+ <property
+ name="subComponentName"
+ value="integrity-audit"></property>
<!-- log file names -->
- <property name="errorLogName" value="error" />
- <property name="metricsLogName" value="metrics" />
- <property name="auditLogName" value="audit" />
- <property name="debugLogName" value="debug" />
+ <property
+ name="errorLogName"
+ value="error" />
+ <property
+ name="metricsLogName"
+ value="metrics" />
+ <property
+ name="auditLogName"
+ value="audit" />
+ <property
+ name="debugLogName"
+ value="debug" />
- <property name="defaultPattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX, UTC}|%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{instanceUuid}|%p|%X{severity}|%X{serverIpAddress}|%X{server}|%X{clientIpAddress}|%c||%msg%n" />
- <!-- <property name="defaultPattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX, UTC}|%X{RequestId}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{Severity}|%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n" /> -->
- <property name="logDirectory" value="${logDir}/${componentName}/${subComponentName}" />
- <property name="debugLogDirectory" value="${debugDir}/${componentName}/${subComponentName}" />
+ <property
+ name="defaultPatternTimestamp"
+ value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX, UTC}" />
+
+ <property
+ name="defaultPatternTarget"
+ value="%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{instanceUuid}" />
+
+
+ <property
+ name="defaultPatternDetails"
+ value="%X{severity}|%X{serverIpAddress}|%X{server}|%X{clientIpAddress}" />
+
+ <property
+ name="defaultPattern"
+ value="${defaultPatternTimestamp}|${defaultPatternTarget}|%p|${defaultPatternDetails}|%c||%msg%n" />
+
+ <property
+ name="logDirectory"
+ value="${logDir}/${componentName}/${subComponentName}" />
+ <property
+ name="debugLogDirectory"
+ value="${debugDir}/${componentName}/${subComponentName}" />
<!--
<property name="logDirectory" value="${logDir}/${componentName}/${subComponentName}" />
<property name="debugLogDirectory" value="${debugDir}/${componentName}/${subComponentName}" />
-->
<!-- example from old log4j.properties: ${catalina.base}/logs/pdp-rest.log -->
<!-- Example evaluator filter applied against console appender -->
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>${defaultPattern}</pattern>
- </encoder>
- </appender>
+ <appender
+ name="STDOUT"
+ class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>${defaultPattern}</pattern>
+ </encoder>
+ </appender>
<!-- ============================================================================ -->
<!-- EELF Appenders -->
@@ -71,99 +110,149 @@
Policy engine events from other components, or it can be eliminated to record
these events as part of the application root log. -->
- <appender name="EELFAudit"
- class="ch.qos.logback.core.FileAppender">
- <file>${logDirectory}/${auditLogName}.log</file>
- <param name="Append" value="false" />
- <encoder>
- <pattern>${defaultPattern}</pattern>
- </encoder>
- </appender>
- <appender name="asyncEELFAudit" class="ch.qos.logback.classic.AsyncAppender">
- <queueSize>256</queueSize>
- <appender-ref ref="EELFAudit" />
- </appender>
-
-<appender name="EELFMetrics"
- class="ch.qos.logback.core.FileAppender">
- <file>${logDirectory}/${metricsLogName}.log</file>
- <param name="Append" value="false" />
- <encoder>
- <!-- <pattern>"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} -
- %msg%n"</pattern> -->
- <pattern>${defaultPattern}</pattern>
- </encoder>
- </appender>
-
-
- <appender name="asyncEELFMetrics" class="ch.qos.logback.classic.AsyncAppender">
- <queueSize>256</queueSize>
- <appender-ref ref="EELFMetrics"/>
- </appender>
-
- <appender name="EELFError"
- class="ch.qos.logback.core.FileAppender">
- <file>${logDirectory}/${errorLogName}.log</file>
- <param name="Append" value="false" />
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>ERROR</level>
- </filter>
- <encoder>
- <pattern>${defaultPattern}</pattern>
- </encoder>
- </appender>
-
- <appender name="asyncEELFError" class="ch.qos.logback.classic.AsyncAppender">
- <queueSize>256</queueSize>
- <appender-ref ref="EELFError"/>
- </appender>
-
- <appender name="EELFDebug"
- class="ch.qos.logback.core.FileAppender">
- <file>${debugLogDirectory}/${debugLogName}.log</file>
- <param name="Append" value="false" />
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <!-- <level>INFO</level> -->
- <level>DEBUG</level>
- </filter>
- <encoder>
- <pattern>${defaultPattern}</pattern>
- </encoder>
- </appender>
-
- <appender name="asyncEELFDebug" class="ch.qos.logback.classic.AsyncAppender">
- <queueSize>256</queueSize>
- <appender-ref ref="EELFDebug" />
- <includeCallerData>true</includeCallerData>
- </appender>
+ <appender
+ name="EELFAudit"
+ class="ch.qos.logback.core.FileAppender">
+ <file>${logDirectory}/${auditLogName}.log</file>
+ <param
+ name="Append"
+ value="false" />
+ <encoder>
+ <pattern>${defaultPattern}</pattern>
+ </encoder>
+ </appender>
+ <appender
+ name="asyncEELFAudit"
+ class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="EELFAudit" />
+ </appender>
+
+ <appender
+ name="EELFMetrics"
+ class="ch.qos.logback.core.FileAppender">
+ <file>${logDirectory}/${metricsLogName}.log</file>
+ <param
+ name="Append"
+ value="false" />
+ <encoder>
+ <pattern>${defaultPattern}</pattern>
+ </encoder>
+ </appender>
+
+
+ <appender
+ name="asyncEELFMetrics"
+ class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="EELFMetrics" />
+ </appender>
+
+ <appender
+ name="EELFError"
+ class="ch.qos.logback.core.FileAppender">
+ <file>${logDirectory}/${errorLogName}.log</file>
+ <param
+ name="Append"
+ value="false" />
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>ERROR</level>
+ </filter>
+ <encoder>
+ <pattern>${defaultPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender
+ name="asyncEELFError"
+ class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="EELFError" />
+ </appender>
+
+ <appender
+ name="EELFDebug"
+ class="ch.qos.logback.core.FileAppender">
+ <file>${debugLogDirectory}/${debugLogName}.log</file>
+ <param
+ name="Append"
+ value="false" />
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>DEBUG</level>
+ </filter>
+ <encoder>
+ <pattern>${defaultPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender
+ name="asyncEELFDebug"
+ class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="EELFDebug" />
+ <includeCallerData>true</includeCallerData>
+ </appender>
+
+ <!-- Appender for log testing -->
+ <appender
+ name="LoggingPatternTestAppender"
+ class="ch.qos.logback.core.FileAppender">
+ <file>${logDirectory}/logging-pattern-test.log</file>
+ <param
+ name="Append"
+ value="false" />
+ <encoder>
+ <pattern>${defaultPattern}</pattern>
+ </encoder>
+ </appender>
<!-- ============================================================================ -->
<!-- EELF loggers -->
<!-- ============================================================================ -->
- <logger name="com.att.eelf.audit" level="info" additivity="false">
- <appender-ref ref="asyncEELFAudit" />
- </logger>
+ <logger
+ name="com.att.eelf.audit"
+ level="info"
+ additivity="false">
+ <appender-ref ref="asyncEELFAudit" />
+ </logger>
- <logger name="com.att.eelf.metrics" level="info" additivity="false">
+ <logger
+ name="com.att.eelf.metrics"
+ level="info"
+ additivity="false">
<appender-ref ref="asyncEELFMetrics" />
- </logger>
+ </logger>
- <logger name="com.att.eelf.error" level="error" additivity="false">
- <appender-ref ref="asyncEELFError" />
- </logger>
+ <logger
+ name="com.att.eelf.error"
+ level="error"
+ additivity="false">
+ <appender-ref ref="asyncEELFError" />
+ </logger>
<!-- <logger name="com.att.eelf.debug" level="info" additivity="false"> -->
- <logger name="com.att.eelf.debug" level="debug" additivity="false">
+ <logger
+ name="com.att.eelf.debug"
+ level="debug"
+ additivity="false">
<appender-ref ref="asyncEELFDebug" />
- </logger>
+ </logger>
<!-- <root level="INFO"> -->
- <root level="DEBUG">
+ <root level="DEBUG">
<appender-ref ref="asyncEELFDebug" />
<appender-ref ref="asyncEELFError" />
- </root>
+ </root>
+
+ <!-- Logger for default pattern test -->
+ <logger
+ name="org.onap.policy.common.ia.DefaultLoggingPatternTest"
+ level="trace"
+ additivity="false">
+ <appender-ref ref="LoggingPatternTestAppender" />
+ </logger>
</configuration>
diff --git a/integrity-audit/src/test/resources/logback.xml b/integrity-audit/src/test/resources/logback.xml
index 59d66a4e..8f493cff 100644
--- a/integrity-audit/src/test/resources/logback.xml
+++ b/integrity-audit/src/test/resources/logback.xml
@@ -20,40 +20,80 @@
<!-- Controls the output of logs for JUnit tests -->
-<configuration scan="true" scanPeriod="3 seconds" debug="true">
+<configuration
+ scan="true"
+ scanPeriod="3 seconds"
+ debug="true">
<!--<jmxConfigurator /> -->
<!-- directory path for all other type logs -->
- <property name="logDir" value="testingLogs" />
+ <property
+ name="logDir"
+ value="testingLogs" />
<!-- directory path for debugging type logs -->
- <property name="debugDir" value="testingLogs" />
+ <property
+ name="debugDir"
+ value="testingLogs" />
<!-- specify the component name
<ONAP-component-name>::= "MSO" | "DCAE" | "ASDC " | "AAI" |"Policy" | "SDNC" | "AC" -->
- <property name="componentName" value="common-modules"></property>
- <property name="subComponentName" value="integrity-audit"></property>
+ <property
+ name="componentName"
+ value="common-modules"></property>
+ <property
+ name="subComponentName"
+ value="integrity-audit"></property>
<!-- log file names -->
- <property name="errorLogName" value="error" />
- <property name="metricsLogName" value="metrics" />
- <property name="auditLogName" value="audit" />
- <property name="debugLogName" value="debug" />
+ <property
+ name="errorLogName"
+ value="error" />
+ <property
+ name="metricsLogName"
+ value="metrics" />
+ <property
+ name="auditLogName"
+ value="audit" />
+ <property
+ name="debugLogName"
+ value="debug" />
- <property name="defaultPattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX, UTC}|%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{instanceUuid}|%p|%X{severity}|%X{serverIpAddress}|%X{server}|%X{clientIpAddress}|%c||%msg%n" />
- <!-- <property name="defaultPattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX, UTC}|%X{RequestId}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{Severity}|%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n" /> -->
- <property name="logDirectory" value="${logDir}/${componentName}/${subComponentName}" />
- <property name="debugLogDirectory" value="${debugDir}/${componentName}/${subComponentName}" />
+ <property
+ name="defaultPatternTimestamp"
+ value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX, UTC}" />
+
+ <property
+ name="defaultPatternTarget"
+ value="%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{instanceUuid}" />
+
+
+ <property
+ name="defaultPatternDetails"
+ value="%X{severity}|%X{serverIpAddress}|%X{server}|%X{clientIpAddress}" />
+
+ <property
+ name="defaultPattern"
+ value="${defaultPatternTimestamp}|${defaultPatternTarget}|%p|${defaultPatternDetails}|%c||%msg%n" />
+
+ <property
+ name="logDirectory"
+ value="${logDir}/${componentName}/${subComponentName}" />
+ <property
+ name="debugLogDirectory"
+ value="${debugDir}/${componentName}/${subComponentName}" />
<!--
<property name="logDirectory" value="${logDir}/${componentName}/${subComponentName}" />
<property name="debugLogDirectory" value="${debugDir}/${componentName}/${subComponentName}" />
-->
<!-- example from old log4j.properties: ${catalina.base}/logs/pdp-rest.log -->
<!-- Example evaluator filter applied against console appender -->
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>${defaultPattern}</pattern>
- </encoder>
- </appender>
+ <appender
+ name="STDOUT"
+ class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>${defaultPattern}</pattern>
+ </encoder>
+ </appender>
<!-- ============================================================================ -->
<!-- EELF Appenders -->
@@ -71,139 +111,152 @@
Policy engine events from other components, or it can be eliminated to record
these events as part of the application root log. -->
- <appender name="EELFAudit"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${logDirectory}/${auditLogName}.log</file>
- <rollingPolicy
- class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${logDirectory}/${auditLogName}.%i.log.zip
- </fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>9</maxIndex>
- </rollingPolicy>
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>5MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>${defaultPattern}</pattern>
- </encoder>
- </appender>
- <appender name="asyncEELFAudit" class="ch.qos.logback.classic.AsyncAppender">
- <queueSize>256</queueSize>
- <appender-ref ref="EELFAudit" />
- </appender>
-
-<appender name="EELFMetrics"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${logDirectory}/${metricsLogName}.log</file>
- <rollingPolicy
- class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${logDirectory}/${metricsLogName}.%i.log.zip
- </fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>9</maxIndex>
- </rollingPolicy>
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>5MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <!-- <pattern>"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} -
- %msg%n"</pattern> -->
- <pattern>${defaultPattern}</pattern>
- </encoder>
- </appender>
-
-
- <appender name="asyncEELFMetrics" class="ch.qos.logback.classic.AsyncAppender">
- <queueSize>256</queueSize>
- <appender-ref ref="EELFMetrics"/>
- </appender>
-
- <appender name="EELFError"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${logDirectory}/${errorLogName}.log</file>
- <rollingPolicy
- class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${logDirectory}/${errorLogName}.%i.log.zip
- </fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>9</maxIndex>
- </rollingPolicy>
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>ERROR</level>
- </filter>
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>5MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>${defaultPattern}</pattern>
- </encoder>
- </appender>
-
- <appender name="asyncEELFError" class="ch.qos.logback.classic.AsyncAppender">
- <queueSize>256</queueSize>
- <appender-ref ref="EELFError"/>
- </appender>
-
- <appender name="EELFDebug"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${debugLogDirectory}/${debugLogName}.log</file>
- <rollingPolicy
- class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${debugLogDirectory}/${debugLogName}.%i.log.zip
- </fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>9</maxIndex>
- </rollingPolicy>
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <!-- <level>INFO</level> -->
- <level>DEBUG</level>
- </filter>
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>5MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>${defaultPattern}</pattern>
- </encoder>
- </appender>
-
- <appender name="asyncEELFDebug" class="ch.qos.logback.classic.AsyncAppender">
- <queueSize>256</queueSize>
- <appender-ref ref="EELFDebug" />
- <includeCallerData>true</includeCallerData>
- </appender>
+ <appender
+ name="EELFAudit"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/${auditLogName}.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/${auditLogName}.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${defaultPattern}</pattern>
+ </encoder>
+ </appender>
+ <appender
+ name="asyncEELFAudit"
+ class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="EELFAudit" />
+ </appender>
+
+ <appender
+ name="EELFMetrics"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/${metricsLogName}.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/${metricsLogName}.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${defaultPattern}</pattern>
+ </encoder>
+ </appender>
+
+
+ <appender
+ name="asyncEELFMetrics"
+ class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="EELFMetrics" />
+ </appender>
+
+ <appender
+ name="EELFError"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/${errorLogName}.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/${errorLogName}.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>ERROR</level>
+ </filter>
+ <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${defaultPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender
+ name="asyncEELFError"
+ class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="EELFError" />
+ </appender>
+
+ <appender
+ name="EELFDebug"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${debugLogDirectory}/${debugLogName}.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${debugLogDirectory}/${debugLogName}.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>DEBUG</level>
+ </filter>
+ <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${defaultPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender
+ name="asyncEELFDebug"
+ class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="EELFDebug" />
+ <includeCallerData>true</includeCallerData>
+ </appender>
<!-- ============================================================================ -->
<!-- EELF loggers -->
<!-- ============================================================================ -->
- <logger name="com.att.eelf.audit" level="info" additivity="false">
- <appender-ref ref="asyncEELFAudit" />
- </logger>
+ <logger
+ name="com.att.eelf.audit"
+ level="info"
+ additivity="false">
+ <appender-ref ref="asyncEELFAudit" />
+ </logger>
- <logger name="com.att.eelf.metrics" level="info" additivity="false">
+ <logger
+ name="com.att.eelf.metrics"
+ level="info"
+ additivity="false">
<appender-ref ref="asyncEELFMetrics" />
- </logger>
+ </logger>
- <logger name="com.att.eelf.error" level="error" additivity="false">
- <appender-ref ref="asyncEELFError" />
- </logger>
+ <logger
+ name="com.att.eelf.error"
+ level="error"
+ additivity="false">
+ <appender-ref ref="asyncEELFError" />
+ </logger>
<!-- <logger name="com.att.eelf.debug" level="info" additivity="false"> -->
- <logger name="com.att.eelf.debug" level="debug" additivity="false">
+ <logger
+ name="com.att.eelf.debug"
+ level="debug"
+ additivity="false">
<appender-ref ref="asyncEELFDebug" />
- </logger>
+ </logger>
<!-- <root level="INFO"> -->
- <root level="DEBUG">
+ <root level="DEBUG">
<appender-ref ref="asyncEELFDebug" />
<appender-ref ref="asyncEELFError" />
- </root>
+ </root>
</configuration>
diff --git a/integrity-audit/src/test/resources/logger-test.expectedlog b/integrity-audit/src/test/resources/logger-test.expectedlog
new file mode 100644
index 00000000..69df8f96
--- /dev/null
+++ b/integrity-audit/src/test/resources/logger-test.expectedlog
@@ -0,0 +1 @@
+2019-12-05T13:24:14.110Z|TheRequestId|TheServiceInstanceId|main|TheServerName|TheServiceName|TheInstanceUuid|INFO|TheSeverity|TheServerIpAddress|TheServer|TheClientIpAddress|org.onap.policy.common.ia.DefaultLoggingPatternTest||This is a test logging string for logger
diff --git a/integrity-audit/src/test/resources/policyLogger.properties b/integrity-audit/src/test/resources/policyLogger.properties
index cb5ef8d2..42cf1cfd 100644
--- a/integrity-audit/src/test/resources/policyLogger.properties
+++ b/integrity-audit/src/test/resources/policyLogger.properties
@@ -7,9 +7,9 @@
# 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.
@@ -23,10 +23,10 @@
timer.delay.time=1000
#Timer scheduleAtFixedRate period - time in milliseconds between successive task executions.
check.interval= 30000
-#Longest time an event info can be stored in the concurrentHashMap for logging - in seconds.
+#Longest time an event info can be stored in the concurrentHashMap for logging - in seconds.
event.expired.time=86400
-#Size of the concurrentHashMap which stores the event starting time, etc - when its size reaches this limit, the Timer gets executed
-#to remove all expired records from this concurrentHashMap.
+#Size of the concurrentHashMap which stores the event starting time, etc - when its size reaches this limit, the Timer
+# gets executed to remove all expired records from this concurrentHashMap.
concurrentHashMap.limit=5000
#Size of the concurrentHashMap - when its size drops to this point, stop the Timer
stop.check.point=2500
@@ -34,7 +34,8 @@ stop.check.point=2500
# set EELF for EELF logging format, set LOG4J for using log4j, set SYSTEMOUT for using system.out.println
logger.type=EELF
#################################### Set level for EELF or SYSTEMOUT logging ##################################
-# Set level for debug file. Set DEBUG to enable .info, .warn and .debug; set INFO for enable .info and .warn; set OFF to disable all
+# Set level for debug file. Set DEBUG to enable .info, .warn and .debug; set INFO for enable .info and .warn; set OFF to
+# disable all
debugLogger.level=DEBUG
# Set level for metrics file. Set OFF to disable; set ON to enable
metricsLogger.level=ON
diff --git a/integrity-audit/src/test/resources/xlogger-test.expectedlog b/integrity-audit/src/test/resources/xlogger-test.expectedlog
new file mode 100644
index 00000000..a9ad4992
--- /dev/null
+++ b/integrity-audit/src/test/resources/xlogger-test.expectedlog
@@ -0,0 +1 @@
+2019-12-05T13:24:14.110Z|TheRequestId|TheServiceInstanceId|main|TheServerName|TheServiceName|TheInstanceUuid|INFO|TheSeverity|TheServerIpAddress|TheServer|TheClientIpAddress|org.onap.policy.common.ia.DefaultLoggingPatternTest||This is a test logging string for xlogger