aboutsummaryrefslogtreecommitdiffstats
path: root/common/openecomp-logging-lib/openecomp-logging-core/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'common/openecomp-logging-lib/openecomp-logging-core/src/main')
-rw-r--r--common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/Markers.java21
-rw-r--r--common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/Slf4JLoggerCreationService.java236
-rw-r--r--common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/aspects/MetricsAspect.java72
-rw-r--r--common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/context/MdcPropagationService.java71
-rw-r--r--common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/logback/DispatchingAppender.java142
-rw-r--r--common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/logback/EventTypeDiscriminator.java121
-rw-r--r--common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/servlet/LoggingFilter.java135
-rw-r--r--common/openecomp-logging-lib/openecomp-logging-core/src/main/resources/META-INF/services/org.openecomp.core.logging.api.LoggerCreationService1
-rw-r--r--common/openecomp-logging-lib/openecomp-logging-core/src/main/resources/META-INF/services/org.openecomp.core.logging.api.context.ContextPropagationService1
9 files changed, 0 insertions, 800 deletions
diff --git a/common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/Markers.java b/common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/Markers.java
deleted file mode 100644
index dc2ae367b3..0000000000
--- a/common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/Markers.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.openecomp.core.logging;
-
-import org.slf4j.Marker;
-import org.slf4j.MarkerFactory;
-
-/**
- * <p>The list of markers that can be used for special logging such as metrics, audit, etc.</p>
- * <p>Although markers can be easily instantiated whenever needed, having constants for them helps
- * eliminate mistakes - misspelling, using a marker that is not handled, etc.</p> <p>Usage:</p>
- * <pre>
- * Logger log = LogFactory.getLogger(this.getClass());
- * log.info(Markers.AUDIT, "User '{}' logged out", user);
- * </pre>
- *
- * @see org.slf4j.Marker
- */
-public class Markers {
-
- public static final Marker AUDIT = MarkerFactory.getMarker("AUDIT");
- public static final Marker METRICS = MarkerFactory.getMarker("METRICS");
-}
diff --git a/common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/Slf4JLoggerCreationService.java b/common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/Slf4JLoggerCreationService.java
deleted file mode 100644
index 3238e75f8e..0000000000
--- a/common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/Slf4JLoggerCreationService.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * 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=========================================================
- */
-
-package org.openecomp.core.logging;
-
-import org.openecomp.core.logging.api.Logger;
-import org.openecomp.core.logging.api.LoggerCreationService;
-import org.slf4j.LoggerFactory;
-
-public class Slf4JLoggerCreationService implements LoggerCreationService {
-
- @Override
- public Logger getLogger(String className) {
- return new Slf4JWrapper(className);
- }
-
- @Override
- public Logger getLogger(Class<?> clazz) {
- return new Slf4JWrapper(clazz);
- }
-
- private class Slf4JWrapper implements Logger {
-
- private final org.slf4j.Logger logger;
-
- public Slf4JWrapper(Class<?> clazz) {
- logger = LoggerFactory.getLogger(clazz);
- }
-
- public Slf4JWrapper(String className) {
- logger = LoggerFactory.getLogger(className);
- }
-
- @Override
- public String getName() {
- return logger.getName();
- }
-
- @Override
- public boolean isMetricsEnabled() {
- return logger.isInfoEnabled(Markers.METRICS);
- }
-
- @Override
- public void metrics(String msg) {
- logger.info(Markers.METRICS, msg);
- }
-
- @Override
- public void metrics(String msg, Object arg) {
- logger.info(Markers.METRICS, msg, arg);
- }
-
- @Override
- public void metrics(String msg, Object arg1, Object arg2) {
- logger.info(Markers.METRICS, msg, arg1, arg2);
- }
-
- @Override
- public void metrics(String msg, Object... arguments) {
- logger.info(Markers.METRICS, msg, arguments);
- }
-
- @Override
- public void metrics(String msg, Throwable throwable) {
- logger.info(Markers.METRICS, msg, throwable);
- }
-
- @Override
- public boolean isAuditEnabled() {
- return logger.isInfoEnabled(Markers.AUDIT);
- }
-
- @Override
- public void audit(String msg) {
- logger.info(Markers.AUDIT, msg);
- }
-
- @Override
- public void audit(String msg, Object arg) {
- logger.info(Markers.AUDIT, msg, arg);
- }
-
- @Override
- public void audit(String msg, Object arg1, Object arg2) {
- logger.info(Markers.AUDIT, msg, arg1, arg2);
- }
-
- @Override
- public void audit(String msg, Object... arguments) {
- logger.info(Markers.AUDIT, msg, arguments);
- }
-
- @Override
- public void audit(String msg, Throwable throwable) {
- logger.info(Markers.AUDIT, msg, throwable);
- }
-
- @Override
- public boolean isDebugEnabled() {
- return logger.isDebugEnabled();
- }
-
- @Override
- public void debug(String msg) {
- logger.debug(msg);
- }
-
- @Override
- public void debug(String format, Object arg) {
- logger.debug(format, arg);
- }
-
- @Override
- public void debug(String format, Object arg1, Object arg2) {
- logger.debug(format, arg1, arg2);
- }
-
- @Override
- public void debug(String format, Object... arguments) {
- logger.debug(format, arguments);
- }
-
- @Override
- public void debug(String msg, Throwable throwable) {
- logger.debug(msg, throwable);
- }
-
- @Override
- public boolean isInfoEnabled() {
- return logger.isInfoEnabled();
- }
-
- @Override
- public void info(String msg) {
- logger.info(msg);
- }
-
- @Override
- public void info(String format, Object arg) {
- logger.info(format, arg);
- }
-
- @Override
- public void info(String format, Object arg1, Object arg2) {
- logger.info(format, arg1, arg2);
- }
-
- @Override
- public void info(String format, Object... arguments) {
- logger.info(format, arguments);
- }
-
- @Override
- public void info(String msg, Throwable throwable) {
- logger.info(msg, throwable);
- }
-
- @Override
- public boolean isWarnEnabled() {
- return logger.isWarnEnabled();
- }
-
- @Override
- public void warn(String msg) {
- logger.warn(msg);
- }
-
- @Override
- public void warn(String format, Object arg) {
- logger.warn(format, arg);
- }
-
- @Override
- public void warn(String format, Object... arguments) {
- logger.warn(format, arguments);
- }
-
- @Override
- public void warn(String format, Object arg1, Object arg2) {
- logger.warn(format, arg1, arg2);
- }
-
- @Override
- public void warn(String msg, Throwable throwable) {
- logger.warn(msg, throwable);
- }
-
- @Override
- public boolean isErrorEnabled() {
- return logger.isErrorEnabled();
- }
-
- @Override
- public void error(String msg) {
- logger.error(msg);
- }
-
- @Override
- public void error(String format, Object arg) {
- logger.error(format, arg);
- }
-
- @Override
- public void error(String format, Object arg1, Object arg2) {
- logger.error(format, arg1, arg2);
- }
-
- @Override
- public void error(String format, Object... arguments) {
- logger.error(format, arguments);
- }
-
- @Override
- public void error(String msg, Throwable throwable) {
- logger.error(msg, throwable);
- }
- }
-}
diff --git a/common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/aspects/MetricsAspect.java b/common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/aspects/MetricsAspect.java
deleted file mode 100644
index 9e8c7f0aa8..0000000000
--- a/common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/aspects/MetricsAspect.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * 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=========================================================
- */
-
-package org.openecomp.core.logging.aspects;
-
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
-import org.openecomp.core.logging.api.Logger;
-import org.openecomp.core.logging.api.LoggerFactory;
-import org.openecomp.core.logging.api.annotations.Metrics;
-
-/**
- * <p>Wraps around any method annotated with {@link Metrics} to measure and log its execution time
- * in milliseconds.</p> <p>In order for the aspect to be used, AspectJ annotation processing must be
- * tuned on and this particular aspect enabled. Conversely, it can be disabled completely if the
- * application does not need to log metrics.</p> <p>See, for example, <a
- * href="http://docs.spring.io/spring/docs/current/spring-framework-reference/html/aop.html"> Aspect
- * Oriented Programming with Spring</a>.</p>
- *
- * @see Metrics
- */
-@Aspect
-public class MetricsAspect {
-
- private static final String MESSAGE_TEMPLATE = "'{}' took {} milliseconds";
-
- /**
- * Log execution time object.
- *
- * @param pjp the pjp
- * @return the object
- * @throws Throwable the throwable
- */
- @Around("@annotation(org.openecomp.core.logging.api.annotations.Metrics)")
- public Object logExecutionTime(ProceedingJoinPoint pjp) throws Throwable {
-
- final Logger logger = LoggerFactory.getLogger(pjp.getSignature().getDeclaringTypeName());
- // measure and log only if the logger for this class is enabled
- if (logger.isMetricsEnabled()) {
-
- final String method = pjp.getSignature().getName();
- final long start = System.currentTimeMillis();
-
- try {
- return pjp.proceed();
- } finally {
- logger.metrics(MESSAGE_TEMPLATE, method, System.currentTimeMillis() - start);
- }
-
- } else {
- return pjp.proceed();
- }
- }
-}
diff --git a/common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/context/MdcPropagationService.java b/common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/context/MdcPropagationService.java
deleted file mode 100644
index 94ad1b9717..0000000000
--- a/common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/context/MdcPropagationService.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * 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=========================================================
- */
-
-package org.openecomp.core.logging.context;
-
-import org.openecomp.core.logging.api.context.ContextPropagationService;
-import org.slf4j.MDC;
-
-import java.util.Map;
-
-/**
- * Propagates the <a href="http://www.slf4j.org/manual.html#mdc">SLF4J Mapped Diagnostic Context
- * (MDC)</a> of a thread onto a runnable created by that thread, so that the context is available
- * when the runnable is executed in a new thread.
- */
-public class MdcPropagationService implements ContextPropagationService {
-
- public Runnable create(Runnable task) {
- return new MdcCopyingWrapper(task);
- }
-
- private static class MdcCopyingWrapper implements Runnable {
-
- private final Runnable task;
- private final Map<String, String> context;
-
- private MdcCopyingWrapper(Runnable task) {
- this.task = task;
- this.context = MDC.getCopyOfContextMap();
- }
-
- private static void replaceMdc(Map<String, String> context) {
-
- if (context == null) {
- MDC.clear();
- } else {
- MDC.setContextMap(context);
- }
- }
-
- @Override
- public void run() {
-
- Map<String, String> oldContext = MDC.getCopyOfContextMap();
- replaceMdc(this.context);
-
- try {
- task.run();
- } finally {
- replaceMdc(oldContext);
- }
- }
- }
-}
diff --git a/common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/logback/DispatchingAppender.java b/common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/logback/DispatchingAppender.java
deleted file mode 100644
index 6d5642e374..0000000000
--- a/common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/logback/DispatchingAppender.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * 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=========================================================
- */
-
-package org.openecomp.core.logging.logback;
-
-import ch.qos.logback.classic.Logger;
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.sift.MDCBasedDiscriminator;
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.Appender;
-import ch.qos.logback.core.AppenderBase;
-import ch.qos.logback.core.joran.spi.DefaultClass;
-import ch.qos.logback.core.sift.Discriminator;
-import org.slf4j.LoggerFactory;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * <p>Allows to use EELF logging configuration almost as is, by using a custom routing function, but
- * pre-configured appenders attached to the standard EELF loggers.</p> <p>Changes that must be made
- * in <i>logback.xml</i> supplied with EELF:</p>
- * <pre>
- * &lt;appender name="DISPATCHER" class="DispatchingAppender"&gt;
- * &lt;discriminator class="EventTypeDiscriminator"/&gt;
- * &lt;appenderNamePattern&gt;asyncEELF%s&lt;/appenderNamePattern&gt;
- * &lt;/appender&gt;
- * &lt;root level="INFO" additivity="false"&gt;
- * &lt;appender-ref ref="DISPATCHER" /&gt;
- * &lt;/root&gt;
- * </pre>
- */
-public class DispatchingAppender extends AppenderBase<ILoggingEvent> {
-
- // "magic" appender to indicate a missing appender
- private static final Appender<ILoggingEvent> NO_APPENDER = new DispatchingAppender();
-
- private Map<String, Appender<ILoggingEvent>> appenders = new ConcurrentHashMap<>();
-
- private Discriminator<ILoggingEvent> discriminator;
- private String appenderNamePattern;
-
- public Discriminator<ILoggingEvent> getDiscriminator() {
- return this.discriminator;
- }
-
- @DefaultClass(MDCBasedDiscriminator.class)
- public void setDiscriminator(Discriminator<ILoggingEvent> discriminator) {
- this.discriminator = discriminator;
- }
-
- public String getAppenderNamePattern() {
- return this.appenderNamePattern;
- }
-
- public void setAppenderNamePattern(String pattern) {
- this.appenderNamePattern = pattern;
- }
-
- @Override
- protected void append(ILoggingEvent event) {
-
- if (this.isStarted()) {
-
- String discriminatingValue = this.discriminator.getDiscriminatingValue(event);
- String appenderName = String.format(this.appenderNamePattern, discriminatingValue);
- Appender<ILoggingEvent> appender = this.lookupAppender(appenderName);
- if (appender == NO_APPENDER) {
- this.addError(String.format("Appender %s does not exist", appenderName));
- } else {
- appender.doAppend(event);
- }
- }
- }
-
- private Appender<ILoggingEvent> lookupAppender(String key) {
-
- Appender<ILoggingEvent> appender = appenders.get(key);
- if (appender != null) {
- return appender;
- }
-
- LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
- for (Logger log : context.getLoggerList()) {
-
- Iterator<Appender<ILoggingEvent>> iterator = log.iteratorForAppenders();
- while (iterator.hasNext()) {
-
- Appender<ILoggingEvent> element = iterator.next();
- if (key.equals(element.getName())) {
- this.appenders.putIfAbsent(key, element);
- return element;
- }
- }
- }
-
- // to avoid consecutive lookups if the required appender does not exist
- this.appenders.putIfAbsent(key, NO_APPENDER);
- return NO_APPENDER;
- }
-
- @Override
- public void start() {
-
- int errors = 0;
- if (this.discriminator == null) {
- this.addError("Missing discriminator. Aborting");
- }
-
- if (!this.discriminator.isStarted()) {
- this.addError("Discriminator has not started successfully. Aborting");
- ++errors;
- }
-
- if (this.appenderNamePattern == null) {
- this.addError("Missing name pattern. Aborting");
- ++errors;
- }
-
- if (errors == 0) {
- super.start();
- }
- }
-}
diff --git a/common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/logback/EventTypeDiscriminator.java b/common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/logback/EventTypeDiscriminator.java
deleted file mode 100644
index 107f6728d7..0000000000
--- a/common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/logback/EventTypeDiscriminator.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * 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=========================================================
- */
-
-package org.openecomp.core.logging.logback;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.sift.AbstractDiscriminator;
-import org.openecomp.core.logging.Markers;
-import org.slf4j.Marker;
-
-/**
- * Can be used with {@link ch.qos.logback.classic.sift.SiftingAppender} to route events of different
- * types to separate log files. For example,
- * <pre>
- * &lt;configuration&gt;
- * &lt;appender name="SIFT" class="ch.qos.logback.classic.sift.SiftingAppender"&gt;
- * &lt;discriminator class="EventTypeDiscriminator"/&gt;
- * &lt;sift&gt;
- * &lt;appender name="{EventType}"
- * class="ch.qos.logback.core.rolling.RollingFileAppender"&gt;
- * &lt;file&gt;${logDirectory}/${eventType}.log&lt;/file&gt;
- * &lt;rollingPolicy class="ch.
- * qos.logback.core.rolling.FixedWindowRollingPolicy"&gt;
- * &lt;fileNamePattern&gt;
- * ${logDirectory}/${eventType}.
- * %i.log.zip&lt;/fileNamePattern&gt;
- * &lt;minIndex&gt;1&lt;/minIndex&gt;
- * &lt;maxIndex&gt;9&lt;/maxIndex&gt;
- * &lt;/rollingPolicy&gt;
- * &lt;triggeringPolicy
- * class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"&gt;
- * &lt;maxFileSize&gt;5MB&lt;/maxFileSize&gt;
- * &lt;/triggeringPolicy&gt;
- * &lt;encoder&gt;
- * &lt;pattern&gt;${defaultPattern}&lt;/pattern&gt;
- * &lt;/encoder&gt;
- * &lt;/appender&gt;
- * &lt;/sift&gt;
- * &lt;/appender&gt;
- * &lt;root level="INFO"&gt;
- * &lt;appender-ref ref="SIFT" /&gt;
- * &lt;/root&gt;
- * &lt;/configuration&gt;
- * </pre>
- */
-public class EventTypeDiscriminator extends AbstractDiscriminator<ILoggingEvent> {
-
- private static final String KEY = "eventType";
-
- private static final String AUDIT = "Audit";
- private static final String METRICS = "Metrics";
- private static final String ERROR = "Error";
- private static final String DEBUG = "Debug";
- private static final String DEFAULT = DEBUG;
-
- private static final int MIN_ERROR_LEVEL = Level.WARN_INT;
- private static final int MAX_ERROR_LEVEL = Level.ERROR_INT;
- private static final int DEFAULT_LEVEL = Level.DEBUG_INT;
-
- @Override
- public String getDiscriminatingValue(ILoggingEvent event) {
-
- Level level = event.getLevel();
- final int levelInt = level == null ? DEFAULT_LEVEL : level.toInt();
- if ((levelInt > MIN_ERROR_LEVEL - 1) && (levelInt < MAX_ERROR_LEVEL + 1)) {
- return ERROR;
- }
-
- if (levelInt == Level.DEBUG_INT) {
- return DEBUG;
- }
-
- /*
- * After DEBUG, ERROR, and WARNING have been filtered out,
- * only TRACE and INFO are left. TRACE is less than DEBUG
- * and therefore cannot be used. So, INFO should be used for
- * custom routing like AUDIT and METRICS
- */
- if (levelInt == Level.INFO_INT) {
-
- final Marker marker = event.getMarker();
- if (marker != null) {
-
- if (marker.contains(Markers.AUDIT)) {
- return AUDIT;
- }
-
- if (marker.contains(Markers.METRICS)) {
- return METRICS;
- }
- }
-
- return ERROR;
- }
-
- return DEFAULT;
- }
-
- @Override
- public String getKey() {
- return KEY;
- }
-}
diff --git a/common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/servlet/LoggingFilter.java b/common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/servlet/LoggingFilter.java
deleted file mode 100644
index 53923d7784..0000000000
--- a/common/openecomp-logging-lib/openecomp-logging-core/src/main/java/org/openecomp/core/logging/servlet/LoggingFilter.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * 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=========================================================
- */
-
-package org.openecomp.core.logging.servlet;
-
-import org.slf4j.MDC;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicLong;
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-
-/**
- * <p>Pushes information required by EELF onto MDC (Mapped Diagnostic Context).</p> <p>This is
- * servlet filter that should be configured in <i>web.xml</i> to be used. Example:</p>
- * <pre>
- * &lt;filter&gt;
- * &lt;filter-name&gt;LoggingServletFilter&lt;/filter-name&gt;
- * &lt;filter-class&gt;LoggingFilter&lt;/filter-class&gt;
- * &lt;/filter&gt;
- * &lt;filter-mapping&gt;
- * &lt;filter-name&gt;LoggingServletFilter&lt;/filter-name&gt;
- * &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
- * &lt;/filter-mapping&gt;
- * </pre>
- */
-public class LoggingFilter implements Filter {
-
- // should be cashed to avoid low-level call, but with a timeout to account for IP or FQDN changes
- private static final HostAddressCache HOST_ADDRESS = new HostAddressCache();
- private static final String UNKNOWN = "UNKNOWN";
-
- public void destroy() {
- }
-
- /**
- * Do Filter.
- *
- * @param request the request
- */
- public void doFilter(ServletRequest request, ServletResponse response,
- FilterChain chain) throws IOException, ServletException {
-
- try {
-
- MDC.clear();
-
- MDC.put("RequestId", UUID.randomUUID().toString());
- MDC.put("ServiceInstanceId", "N/A"); // not applicable
- MDC.put("ServiceName", "SDC");
- MDC.put("InstanceUUID", "N/A");
-
- // For some reason chooses IPv4 or IPv6 in a random way
- MDC.put("RemoteHost", request.getRemoteHost());
-
- InetAddress host = HOST_ADDRESS.get();
-
- String ipAddress;
- String hostName;
- if (host == null) {
- ipAddress = UNKNOWN;
- hostName = UNKNOWN;
- } else {
- ipAddress = host.getHostAddress();
- hostName = host.getHostName();
- }
-
- MDC.put("ServerIPAddress", ipAddress);
- MDC.put("ServerFQDN", hostName);
-
- // TODO: Clarify what these stand for
- // MDC.put("AlertSeverity", );
- // MDC.put("Timer", );
-
- chain.doFilter(request, response);
-
- } finally {
- MDC.clear();
- }
- }
-
- public void init(FilterConfig config) throws ServletException {
- }
-
- private static class HostAddressCache {
-
- private static final long REFRESH_TIME = 1000L;
-
- private AtomicLong lastUpdated = new AtomicLong(0L);
- private InetAddress hostAddress;
-
- public InetAddress get() {
-
- long current = System.currentTimeMillis();
- if (current - lastUpdated.get() > REFRESH_TIME) {
-
- synchronized (this) {
-
- try {
- lastUpdated.set(current); // set now to register the attempt even if failed
- hostAddress = InetAddress.getLocalHost();
- } catch (UnknownHostException unknownHostException) {
- hostAddress = null;
- }
- }
- }
-
- return hostAddress;
- }
- }
-}
diff --git a/common/openecomp-logging-lib/openecomp-logging-core/src/main/resources/META-INF/services/org.openecomp.core.logging.api.LoggerCreationService b/common/openecomp-logging-lib/openecomp-logging-core/src/main/resources/META-INF/services/org.openecomp.core.logging.api.LoggerCreationService
deleted file mode 100644
index ecbf5e8fbe..0000000000
--- a/common/openecomp-logging-lib/openecomp-logging-core/src/main/resources/META-INF/services/org.openecomp.core.logging.api.LoggerCreationService
+++ /dev/null
@@ -1 +0,0 @@
-org.openecomp.core.logging.Slf4JLoggerCreationService \ No newline at end of file
diff --git a/common/openecomp-logging-lib/openecomp-logging-core/src/main/resources/META-INF/services/org.openecomp.core.logging.api.context.ContextPropagationService b/common/openecomp-logging-lib/openecomp-logging-core/src/main/resources/META-INF/services/org.openecomp.core.logging.api.context.ContextPropagationService
deleted file mode 100644
index 91297681ec..0000000000
--- a/common/openecomp-logging-lib/openecomp-logging-core/src/main/resources/META-INF/services/org.openecomp.core.logging.api.context.ContextPropagationService
+++ /dev/null
@@ -1 +0,0 @@
-org.openecomp.core.logging.context.MdcPropagationService \ No newline at end of file