summaryrefslogtreecommitdiffstats
path: root/feature-eelf/src
diff options
context:
space:
mode:
Diffstat (limited to 'feature-eelf/src')
-rw-r--r--feature-eelf/src/assembly/assemble_zip.xml76
-rw-r--r--feature-eelf/src/main/feature/config/logback-eelf.xml184
-rw-r--r--feature-eelf/src/main/feature/install/disable33
-rw-r--r--feature-eelf/src/main/feature/install/enable35
-rw-r--r--feature-eelf/src/main/java/org/onap/policy/drools/eelf/EelfFeature.java73
-rw-r--r--feature-eelf/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi1
-rw-r--r--feature-eelf/src/test/java/org/onap/policy/drools/eelf/test/EElfTest.java146
7 files changed, 0 insertions, 548 deletions
diff --git a/feature-eelf/src/assembly/assemble_zip.xml b/feature-eelf/src/assembly/assemble_zip.xml
deleted file mode 100644
index 005d0389..00000000
--- a/feature-eelf/src/assembly/assemble_zip.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<!--
- ============LICENSE_START=======================================================
- feature-eelf
- ================================================================================
- Copyright (C) 2017 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=========================================================
- -->
-
-<!-- Defines how we build the .zip file which is our distribution. -->
-
-<assembly
- xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
-
- <id>feature-eelf-package</id>
- <formats>
- <format>zip</format>
- </formats>
-
- <includeBaseDirectory>false</includeBaseDirectory>
-
- <fileSets>
- <fileSet>
- <directory>target</directory>
- <outputDirectory>lib/feature</outputDirectory>
- <includes>
- <include>feature-eelf-${project.version}.jar</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>target/assembly/lib</directory>
- <outputDirectory>lib/dependencies</outputDirectory>
- <includes>
- <include>*.jar</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>src/main/feature/config</directory>
- <outputDirectory>config</outputDirectory>
- <fileMode>0644</fileMode>
- <excludes/>
- </fileSet>
- <fileSet>
- <directory>src/main/feature/bin</directory>
- <outputDirectory>bin</outputDirectory>
- <fileMode>0744</fileMode>
- <excludes/>
- </fileSet>
- <fileSet>
- <directory>src/main/feature/db</directory>
- <outputDirectory>db</outputDirectory>
- <fileMode>0744</fileMode>
- <excludes/>
- </fileSet>
- <fileSet>
- <directory>src/main/feature/install</directory>
- <outputDirectory>install</outputDirectory>
- <fileMode>0744</fileMode>
- <excludes/>
- </fileSet>
- </fileSets>
-
-</assembly>
diff --git a/feature-eelf/src/main/feature/config/logback-eelf.xml b/feature-eelf/src/main/feature/config/logback-eelf.xml
deleted file mode 100644
index 7acd33fa..00000000
--- a/feature-eelf/src/main/feature/config/logback-eelf.xml
+++ /dev/null
@@ -1,184 +0,0 @@
-<!--
- ============LICENSE_START=======================================================
- feature-eelf
- ================================================================================
- Copyright (C) 2017-2020 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=========================================================
- -->
-
-<configuration scan="true" scanPeriod="60 seconds" debug="false">
-
- <property name="errorLogName" value="error" />
- <property name="metricsLogName" value="metrics" />
- <property name="auditLogName" value="audit" />
- <property name="debugLogName" value="debug" />
- <property name="networkLogName" value="network" />
-
- <property name="defaultPattern"
- value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity:-NA}|%X{TargetServiceName:-NA}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{Severity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%class||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
- <property name="defaultMetricPattern"
- value="${defaultPattern}" />
- <property name="defaultAuditPattern"
- value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{Severity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%class|%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
- <property name="defaultErrorPattern"
- value="%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%X{RequestID}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{ErrorCategory}|%X{ErrorCode}|%X{ErrorDescription}|%msg%replace(%xException){'\n',' - '}%nopex%n" />
- <property name="networkPattern" value="[%d|%t]%m%n" />
- <property name="abstractNetworkPattern"
- value="[%d] [%X{networkEventType:-NULL}|%X{networkProtocol:-NULL}|%X{networkTopic:-NULL}|%X{requestID:-NULL}]%n" />
- <property name="debugPattern" value="[%date|%level|%logger{0}|%thread] %replace(%msg){'\n', ' '}%n" />
-
- <property name="logDirectory" value="logs/Policy" />
- <property name="debugLogDirectory" value="logs/Policy" />
-
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>${defaultPattern}</pattern>
- </encoder>
- </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>5</maxIndex>
- </rollingPolicy>
- <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>10MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>${defaultAuditPattern}</pattern>
- </encoder>
- </appender>
-
- <appender name="asyncEELFAudit" class="ch.qos.logback.classic.AsyncAppender">
- <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>5</maxIndex>
- </rollingPolicy>
- <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>15MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>${defaultMetricPattern}</pattern>
- </encoder>
- </appender>
-
-
- <appender name="asyncEELFMetrics" class="ch.qos.logback.classic.AsyncAppender">
- <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>5</maxIndex>
- </rollingPolicy>
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>ERROR</level>
- </filter>
- <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>20MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>${defaultErrorPattern}</pattern>
- </encoder>
- </appender>
-
- <appender name="asyncEELFError" class="ch.qos.logback.classic.AsyncAppender">
- <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>5</maxIndex>
- </rollingPolicy>
- <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>20MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>${debugPattern}</pattern>
- </encoder>
- </appender>
-
- <appender name="asyncEELFDebug" class="ch.qos.logback.classic.AsyncAppender">
- <appender-ref ref="EELFDebug" />
- </appender>
-
- <appender name="NetworkOut" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${logDirectory}/${networkLogName}.log</file>
- <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${logDirectory}/${networkLogName}.%i.log.zip
- </fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>5</maxIndex>
- </rollingPolicy>
- <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>15MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>${networkPattern}</pattern>
- </encoder>
- </appender>
-
- <appender name="AsyncNetworkOut" class="ch.qos.logback.classic.AsyncAppender">
- <appender-ref ref="NetworkOut" />
- </appender>
-
- <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">
- <appender-ref ref="asyncEELFMetrics" />
- </logger>
-
- <logger name="com.att.eelf.error" level="error" additivity="false">
- <appender-ref ref="asyncEELFError" />
- </logger>
-
- <logger name="com.att.eelf.debug" level="info">
- <appender-ref ref="asyncEELFDebug" />
- </logger>
-
- <logger name="network" level="INFO" additivity="false">
- <appender-ref ref="AsyncNetworkOut" />
- </logger>
-
- <logger name="org.eclipse.jetty.server.RequestLog" level="info" additivity="false">
- <appender-ref ref="AsyncNetworkOut" />
- </logger>
-
- <root level="INFO">
- <appender-ref ref="asyncEELFDebug" />
- <appender-ref ref="asyncEELFError" />
- </root>
-
-</configuration>
diff --git a/feature-eelf/src/main/feature/install/disable b/feature-eelf/src/main/feature/install/disable
deleted file mode 100644
index eb4e0fac..00000000
--- a/feature-eelf/src/main/feature/install/disable
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env sh
-
-###
-# ============LICENSE_START=======================================================
-# ONAP POLICY
-# ================================================================================
-# Copyright (C) 2017-2021 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=========================================================
-##
-
-if [ "${DEBUG}" = "y" ]; then
- set -x
-fi
-
-SYSTEM_PROPS="${POLICY_HOME}"/config/system.properties
-
-if [ -f "${SYSTEM_PROPS}" ] && [ -r "${SYSTEM_PROPS}" ]; then
- if grep -q "^logback.configurationFile=.*$" "${SYSTEM_PROPS}"; then
- sed -i -e "s|^logback.configurationFile=.*$|logback.configurationFile=config/logback.xml|" "${SYSTEM_PROPS}"
- fi
-fi
diff --git a/feature-eelf/src/main/feature/install/enable b/feature-eelf/src/main/feature/install/enable
deleted file mode 100644
index 50cd9c1e..00000000
--- a/feature-eelf/src/main/feature/install/enable
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env sh
-
-###
-# ============LICENSE_START=======================================================
-# ONAP POLICY
-# ================================================================================
-# Copyright (C) 2017-2021 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=========================================================
-##
-
-if [ "${DEBUG}" = "y" ]; then
- set -x
-fi
-
-SYSTEM_PROPS="${POLICY_HOME}"/config/system.properties
-
-if [ -f "${SYSTEM_PROPS}" ] && [ -r "${SYSTEM_PROPS}" ]; then
- if grep -q "^logback.configurationFile=.*$" "${SYSTEM_PROPS}"; then
- sed -i -e "s|^logback.configurationFile=.*$|logback.configurationFile=config/logback-eelf.xml|" "${SYSTEM_PROPS}"
- else
- echo "logback.configurationFile=config/logback-eelf.xml" >> "${SYSTEM_PROPS}"
- fi
-fi
diff --git a/feature-eelf/src/main/java/org/onap/policy/drools/eelf/EelfFeature.java b/feature-eelf/src/main/java/org/onap/policy/drools/eelf/EelfFeature.java
deleted file mode 100644
index 58679d48..00000000
--- a/feature-eelf/src/main/java/org/onap/policy/drools/eelf/EelfFeature.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * feature-eelf
- * ================================================================================
- * Copyright (C) 2017-2019, 2021 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=========================================================
- */
-
-package org.onap.policy.drools.eelf;
-
-import com.att.eelf.configuration.Configuration;
-import java.nio.file.Paths;
-import org.onap.policy.common.logging.flexlogger.FlexLogger;
-import org.onap.policy.common.logging.flexlogger.Logger;
-import org.onap.policy.drools.features.PolicyEngineFeatureApi;
-import org.onap.policy.drools.system.PolicyEngine;
-import org.onap.policy.drools.utils.logging.LoggerUtil;
-
-/**
- * Feature EELF : Enables EELF Logging Libraries .
- */
-public class EelfFeature implements PolicyEngineFeatureApi {
-
- @Override
- public final boolean beforeBoot(PolicyEngine engine, String[] cliArgs) {
-
- String logback = System.getProperty(LoggerUtil.LOGBACK_CONFIGURATION_FILE_SYSTEM_PROPERTY,
- LoggerUtil.LOGBACK_CONFIGURATION_FILE_DEFAULT);
- var logbackPath = Paths.get(logback);
-
- if (System.getProperty(Configuration.PROPERTY_LOGGING_FILE_PATH) == null) {
- System.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH,
- logbackPath.toAbsolutePath().getParent().toString());
- }
-
- if (System.getProperty(Configuration.PROPERTY_LOGGING_FILE_NAME) == null) {
- System.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME,
- logbackPath.getFileName().toString());
- }
-
- var logger = FlexLogger.getLogger(this.getClass(), true);
-
- if (logger.isInfoEnabled()) {
- logProperty(logger, LoggerUtil.LOGBACK_CONFIGURATION_FILE_SYSTEM_PROPERTY);
- logProperty(logger, Configuration.PROPERTY_LOGGING_FILE_PATH);
- logProperty(logger, Configuration.PROPERTY_LOGGING_FILE_NAME);
- }
-
- return false;
- }
-
- private void logProperty(Logger logger, String propnm) {
- logger.info("eelf-feature: Property " + propnm + "=" + System.getProperty(propnm));
- }
-
- @Override
- public int getSequenceNumber() {
- return 0;
- }
-
-}
diff --git a/feature-eelf/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi b/feature-eelf/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi
deleted file mode 100644
index f2bcc4cb..00000000
--- a/feature-eelf/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi
+++ /dev/null
@@ -1 +0,0 @@
-org.onap.policy.drools.eelf.EelfFeature
diff --git a/feature-eelf/src/test/java/org/onap/policy/drools/eelf/test/EElfTest.java b/feature-eelf/src/test/java/org/onap/policy/drools/eelf/test/EElfTest.java
deleted file mode 100644
index 10e2632a..00000000
--- a/feature-eelf/src/test/java/org/onap/policy/drools/eelf/test/EElfTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * feature-eelf
- * ================================================================================
- * Copyright (C) 2017-2020 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=========================================================
- */
-
-package org.onap.policy.drools.eelf.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import ch.qos.logback.classic.LoggerContext;
-import com.att.eelf.configuration.Configuration;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFLogger.Level;
-import com.att.eelf.configuration.EELFManager;
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.Test;
-import org.onap.policy.common.logging.flexlogger.FlexLogger;
-import org.onap.policy.drools.eelf.EelfFeature;
-import org.onap.policy.drools.system.PolicyEngineConstants;
-import org.onap.policy.drools.utils.logging.LoggerUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Logger Tests.
- */
-public class EElfTest {
-
- /**
- * logback configuration location.
- */
- public static final String LOGBACK_CONFIGURATION_FILE_DEFAULT = "src/main/feature/config/logback-eelf.xml";
-
- /**
- * SLF4J Logger.
- */
- private final Logger slf4jLogger = LoggerFactory.getLogger(EElfTest.class);
-
- /**
- * Get all loggers.
- *
- * @return list of all loggers
- */
- protected List<String> loggers() {
- List<String> loggers = new ArrayList<String>();
- LoggerContext context =
- (LoggerContext) org.slf4j.LoggerFactory.getILoggerFactory();
- for (org.slf4j.Logger logger: context.getLoggerList()) {
- loggers.add(logger.getName());
- }
- slf4jLogger.info(loggers.toString());
- return loggers;
- }
-
- /**
- * Assert Log Levels are the same between an EELF Logger and an SLF4J Logger.
- *
- * @param eelfLogger EELF Logger
- * @param slf4jLogger SLF4J Logger
- */
- protected void assertLogLevels(EELFLogger eelfLogger, Logger slf4jLogger) {
- assertEquals(slf4jLogger.isDebugEnabled(), eelfLogger.isDebugEnabled());
- assertEquals(slf4jLogger.isInfoEnabled(), eelfLogger.isInfoEnabled());
- assertEquals(slf4jLogger.isErrorEnabled(), eelfLogger.isErrorEnabled());
- assertEquals(slf4jLogger.isWarnEnabled(), eelfLogger.isWarnEnabled());
- assertEquals(slf4jLogger.isTraceEnabled(), eelfLogger.isTraceEnabled());
- }
-
- @Test
- public void testSlf4jLog() {
-
- /* standard slf4j using defaults */
-
- slf4jLogger.info("slf4j info");
-
- List<String> loggers = loggers();
-
- assertFalse(loggers.contains(Configuration.DEBUG_LOGGER_NAME));
- assertFalse(loggers.contains(Configuration.AUDIT_LOGGER_NAME));
- assertFalse(loggers.contains(Configuration.ERROR_LOGGER_NAME));
- assertFalse(loggers.contains(Configuration.METRICS_LOGGER_NAME));
-
- /* set logback configuration */
-
- System.setProperty(LoggerUtil.LOGBACK_CONFIGURATION_FILE_SYSTEM_PROPERTY,
- LOGBACK_CONFIGURATION_FILE_DEFAULT);
-
- /* set up eelf throuth common loggings library */
-
- EelfFeature feature = new EelfFeature();
- feature.beforeBoot(PolicyEngineConstants.getManager(), null);
-
- loggers = loggers();
- assertTrue(loggers.contains(Configuration.DEBUG_LOGGER_NAME));
- assertTrue(loggers.contains(Configuration.AUDIT_LOGGER_NAME));
- assertTrue(loggers.contains(Configuration.ERROR_LOGGER_NAME));
- assertTrue(loggers.contains(Configuration.METRICS_LOGGER_NAME));
-
- final EELFLogger eelfAuditLogger = EELFManager.getAuditLogger();
- final Logger slf4jAuditLogger = org.slf4j.LoggerFactory.getLogger(Configuration.AUDIT_LOGGER_NAME);
- org.onap.policy.common.logging.flexlogger.Logger flexLogger =
- FlexLogger.getLogger(EElfTest.class, true);
-
- /* generate an error entry */
-
- Exception testException = new IllegalStateException("exception test");
- flexLogger.error("flex-logger exception", testException);
- EELFManager.getErrorLogger().error("eelf-logger exception", testException);
- org.slf4j.LoggerFactory.getLogger(Configuration.ERROR_LOGGER_NAME).error("slf4j-logger", testException);
-
-
- /* generate an audit entry through all logs */
-
- flexLogger.audit("flexlogger audit");
- eelfAuditLogger.info("eelf audit");
- slf4jAuditLogger.info("slf4j audit");
-
- /* check log levels in eelf and standard slf4j change in both directions */
-
- /* eelf initiated */
- eelfAuditLogger.setLevel(Level.ERROR);
- assertLogLevels(eelfAuditLogger, slf4jAuditLogger);
-
- /* slf4j initiated */
- ((ch.qos.logback.classic.Logger) slf4jLogger).setLevel((ch.qos.logback.classic.Level.INFO));
- assertLogLevels(eelfAuditLogger, slf4jAuditLogger);
- }
-}