From df73577f01e131fb0638e7d5ae3a85217975e9e9 Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Fri, 5 Apr 2024 23:30:53 +0200 Subject: Update eelf-core in logging-service - update eelf-core from version 1.0.1-oss to 2.0.0-oss Issue-ID: AAI-3819 Change-Id: I245db4fea5ba2c369475a8bfdccba6b1db4c8301 Signed-off-by: Fiete Ostkamp --- eelf-logging/pom.xml | 20 +- .../org/onap/aai/cl/eelf/AaiLoggerAdapter.java | 4 +- .../java/org/onap/aai/cl/eelf/LogMessageEnum.java | 5 +- .../java/org/onap/aai/cl/eelf/LoggerFactory.java | 17 +- .../org/onap/aai/cl/eelf/AAILoggerAdapterTest.java | 501 +++++++++++++++------ 5 files changed, 385 insertions(+), 162 deletions(-) (limited to 'eelf-logging') diff --git a/eelf-logging/pom.xml b/eelf-logging/pom.xml index 02ad583..c147a36 100644 --- a/eelf-logging/pom.xml +++ b/eelf-logging/pom.xml @@ -25,7 +25,7 @@ limitations under the License. org.onap.aai.logging-service logging-service - 1.8.0-SNAPSHOT + 1.13.0-SNAPSHOT @@ -38,28 +38,14 @@ limitations under the License. org.onap.aai.logging-service logging-api - 1.8.0-SNAPSHOT + 1.13.0-SNAPSHOT com.att.eelf eelf-core - 1.0.1-oss - - - org.mockito - mockito-core - - - org.powermock - powermock-module-junit4 - - - org.powermock - powermock-api-mockito - - + 2.0.0-oss diff --git a/eelf-logging/src/main/java/org/onap/aai/cl/eelf/AaiLoggerAdapter.java b/eelf-logging/src/main/java/org/onap/aai/cl/eelf/AaiLoggerAdapter.java index 25ab5ee..fde9ab0 100644 --- a/eelf-logging/src/main/java/org/onap/aai/cl/eelf/AaiLoggerAdapter.java +++ b/eelf-logging/src/main/java/org/onap/aai/cl/eelf/AaiLoggerAdapter.java @@ -22,7 +22,7 @@ package org.onap.aai.cl.eelf; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFLogger.Level; -import com.att.eelf.i18n.EELFResolvableErrorEnum; +import com.att.eelf.i18n.EELFResolvableResourceEnum; import com.att.eelf.i18n.EELFResourceManager; import org.onap.aai.cl.api.LogFields; import org.onap.aai.cl.api.LogLine; @@ -336,7 +336,7 @@ public class AaiLoggerAdapter implements Logger { @Override public String formatMsg(Enum logCode, String... arguments) { - return EELFResourceManager.getMessage((EELFResolvableErrorEnum) logCode, arguments); + return EELFResourceManager.getMessage((EELFResolvableResourceEnum) logCode, arguments); } private LogLine getLogLine() { diff --git a/eelf-logging/src/main/java/org/onap/aai/cl/eelf/LogMessageEnum.java b/eelf-logging/src/main/java/org/onap/aai/cl/eelf/LogMessageEnum.java index 6bfe41b..3373537 100644 --- a/eelf-logging/src/main/java/org/onap/aai/cl/eelf/LogMessageEnum.java +++ b/eelf-logging/src/main/java/org/onap/aai/cl/eelf/LogMessageEnum.java @@ -20,12 +20,11 @@ */ package org.onap.aai.cl.eelf; -import com.att.eelf.i18n.EELFResolvableErrorEnum; -import com.att.eelf.i18n.EELFResourceManager; +import com.att.eelf.i18n.EELFResolvableResourceEnum; /** This is a placeholder which client-specific message key enumerations should * implement in order to tie into the log template functionality of the EELF * framework. */ -public interface LogMessageEnum extends EELFResolvableErrorEnum { +public interface LogMessageEnum extends EELFResolvableResourceEnum { } diff --git a/eelf-logging/src/main/java/org/onap/aai/cl/eelf/LoggerFactory.java b/eelf-logging/src/main/java/org/onap/aai/cl/eelf/LoggerFactory.java index bd6b8d0..a31b859 100644 --- a/eelf-logging/src/main/java/org/onap/aai/cl/eelf/LoggerFactory.java +++ b/eelf-logging/src/main/java/org/onap/aai/cl/eelf/LoggerFactory.java @@ -37,11 +37,6 @@ public class LoggerFactory implements LoggerFactoryInterface { /** The instance for our factory singleton. */ private static LoggerFactory instance; - /** An instance of the log factory provided by the EELF framework. We will use - * this to get an actual EELF logger instance that we will wrap within our - * own, more generalized logger. */ - private EELFManager eelfManager; - /** This cache maintains a mapping of logger names to instances so that if a * logger with the same name is requested multiple times we can return the * same instance each time. */ @@ -76,12 +71,6 @@ public class LoggerFactory implements LoggerFactoryInterface { */ protected LoggerFactory() { - // We need an instance of the factory provided by the EELF - // framework so that we can instantiate the EELF logger that - // we will be wrapping, so get one now. - if (eelfManager == null) { - eelfManager = EELFManager.getInstance(); - } } /** @@ -96,7 +85,7 @@ public class LoggerFactory implements LoggerFactoryInterface { if (!errorLoggerCache.containsKey(name)) { // Nothing in the cache, so let's instantiate a logger now. - Logger logger = new AaiLoggerAdapter(eelfManager.getLogger(name), LogLineType.ERROR, name); + Logger logger = new AaiLoggerAdapter(EELFManager.getLogger(name), LogLineType.ERROR, name); errorLoggerCache.put(name, logger); } @@ -126,7 +115,7 @@ public class LoggerFactory implements LoggerFactoryInterface { if (!auditLoggerCache.containsKey(name)) { // Nothing in the cache, so let's instantiate a logger now. - Logger logger = new AaiLoggerAdapter(eelfManager.getAuditLogger(), LogLineType.AUDIT, name); + Logger logger = new AaiLoggerAdapter(EELFManager.getAuditLogger(), LogLineType.AUDIT, name); auditLoggerCache.put(name, logger); } @@ -156,7 +145,7 @@ public class LoggerFactory implements LoggerFactoryInterface { if (!metricLoggerCache.containsKey(name)) { // Nothing in the cache, so let's instantiate a logger now. - Logger logger = new AaiLoggerAdapter(eelfManager.getMetricsLogger(), LogLineType.METRICS, + Logger logger = new AaiLoggerAdapter(EELFManager.getMetricsLogger(), LogLineType.METRICS, name); metricLoggerCache.put(name, logger); } diff --git a/eelf-logging/src/test/java/org/onap/aai/cl/eelf/AAILoggerAdapterTest.java b/eelf-logging/src/test/java/org/onap/aai/cl/eelf/AAILoggerAdapterTest.java index a033776..1afe9ed 100644 --- a/eelf-logging/src/test/java/org/onap/aai/cl/eelf/AAILoggerAdapterTest.java +++ b/eelf-logging/src/test/java/org/onap/aai/cl/eelf/AAILoggerAdapterTest.java @@ -25,7 +25,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.i18n.EELFResolvableErrorEnum; +import com.att.eelf.i18n.EELFResolvableResourceEnum; + import java.util.Locale; import org.junit.Before; import org.junit.Test; @@ -35,6 +36,7 @@ import org.onap.aai.cl.api.LogLine.DefinedFields; import org.onap.aai.cl.api.LogLine.LogLineType; import org.onap.aai.cl.mdc.MdcContext; import org.onap.aai.cl.mdc.MdcOverride; +import org.slf4j.Marker; /** This suite of tests is intended to validate the functionality of our wrapper * around the {@link EELFLogger}. */ @@ -322,31 +324,6 @@ public class AAILoggerAdapterTest { "AAILoggerAdapter is not expected to call into this method."); } - @Override - public void warn(Locale locale, EELFResolvableErrorEnum errorCode, Throwable th, - String... args) { - throw new UnsupportedOperationException( - "AAILoggerAdapter is not expected to call into this method."); - } - - @Override - public void warn(Locale locale, EELFResolvableErrorEnum errorCode, String... args) { - throw new UnsupportedOperationException( - "AAILoggerAdapter is not expected to call into this method."); - } - - @Override - public void warn(EELFResolvableErrorEnum errorCode, String... args) { - throw new UnsupportedOperationException( - "AAILoggerAdapter is not expected to call into this method."); - } - - @Override - public void warn(EELFResolvableErrorEnum errorCode, Throwable th, String... args) { - throw new UnsupportedOperationException( - "AAILoggerAdapter is not expected to call into this method."); - } - @Override public void debug(String msg) { logMessage = msg; @@ -365,31 +342,6 @@ public class AAILoggerAdapterTest { "AAILoggerAdapter is not expected to call into this method."); } - @Override - public void debug(Locale locale, EELFResolvableErrorEnum errorCode, Throwable th, - String... args) { - throw new UnsupportedOperationException( - "AAILoggerAdapter is not expected to call into this method."); - } - - @Override - public void debug(Locale locale, EELFResolvableErrorEnum errorCode, String... args) { - throw new UnsupportedOperationException( - "AAILoggerAdapter is not expected to call into this method."); - } - - @Override - public void debug(EELFResolvableErrorEnum errorCode, String... args) { - throw new UnsupportedOperationException( - "AAILoggerAdapter is not expected to call into this method."); - } - - @Override - public void debug(EELFResolvableErrorEnum errorCode, Throwable th, String... args) { - throw new UnsupportedOperationException( - "AAILoggerAdapter is not expected to call into this method."); - } - @Override public void trace(String msg) { logMessage = msg; @@ -408,31 +360,6 @@ public class AAILoggerAdapterTest { "AAILoggerAdapter is not expected to call into this method."); } - @Override - public void trace(Locale locale, EELFResolvableErrorEnum errorCode, Throwable th, - String... args) { - throw new UnsupportedOperationException( - "AAILoggerAdapter is not expected to call into this method."); - } - - @Override - public void trace(Locale locale, EELFResolvableErrorEnum errorCode, String... args) { - throw new UnsupportedOperationException( - "AAILoggerAdapter is not expected to call into this method."); - } - - @Override - public void trace(EELFResolvableErrorEnum errorCode, String... args) { - throw new UnsupportedOperationException( - "AAILoggerAdapter is not expected to call into this method."); - } - - @Override - public void trace(EELFResolvableErrorEnum errorCode, Throwable th, String... args) { - throw new UnsupportedOperationException( - "AAILoggerAdapter is not expected to call into this method."); - } - @Override public void info(String msg) { logMessage = msg; @@ -445,31 +372,6 @@ public class AAILoggerAdapterTest { "AAILoggerAdapter is not expected to call into this method."); } - @Override - public void info(Locale locale, EELFResolvableErrorEnum errorCode, Throwable th, - String... args) { - throw new UnsupportedOperationException( - "AAILoggerAdapter is not expected to call into this method."); - } - - @Override - public void info(Locale locale, EELFResolvableErrorEnum errorCode, String... args) { - throw new UnsupportedOperationException( - "AAILoggerAdapter is not expected to call into this method."); - } - - @Override - public void info(EELFResolvableErrorEnum errorCode, String... args) { - throw new UnsupportedOperationException( - "AAILoggerAdapter is not expected to call into this method."); - } - - @Override - public void info(EELFResolvableErrorEnum errorCode, Throwable th, String... args) { - throw new UnsupportedOperationException( - "AAILoggerAdapter is not expected to call into this method."); - } - @Override public void error(String msg) { logMessage = msg; @@ -488,31 +390,6 @@ public class AAILoggerAdapterTest { "AAILoggerAdapter is not expected to call into this method."); } - @Override - public void error(Locale locale, EELFResolvableErrorEnum errorCode, Throwable th, - String... args) { - throw new UnsupportedOperationException( - "AAILoggerAdapter is not expected to call into this method."); - } - - @Override - public void error(Locale locale, EELFResolvableErrorEnum errorCode, String... args) { - throw new UnsupportedOperationException( - "AAILoggerAdapter is not expected to call into this method."); - } - - @Override - public void error(EELFResolvableErrorEnum errorCode, String... args) { - throw new UnsupportedOperationException( - "AAILoggerAdapter is not expected to call into this method."); - } - - @Override - public void error(EELFResolvableErrorEnum errorCode, Throwable th, String... args) { - throw new UnsupportedOperationException( - "AAILoggerAdapter is not expected to call into this method."); - } - @Override public boolean isTraceEnabled() { return false; @@ -807,5 +684,377 @@ public class AAILoggerAdapterTest { System.out.println("\n\n---\n" + logMessage + "\n-------"); return logMessage.split("\\|"); } + + @Override + public String getName() { + + throw new UnsupportedOperationException("Unimplemented method 'getName'"); + } + + @Override + public void trace(String format, Object arg) { + + throw new UnsupportedOperationException("Unimplemented method 'trace'"); + } + + @Override + public void trace(String format, Object arg1, Object arg2) { + + throw new UnsupportedOperationException("Unimplemented method 'trace'"); + } + + @Override + public boolean isTraceEnabled(Marker marker) { + + throw new UnsupportedOperationException("Unimplemented method 'isTraceEnabled'"); + } + + @Override + public void trace(Marker marker, String msg) { + + throw new UnsupportedOperationException("Unimplemented method 'trace'"); + } + + @Override + public void trace(Marker marker, String format, Object arg) { + + throw new UnsupportedOperationException("Unimplemented method 'trace'"); + } + + @Override + public void trace(Marker marker, String format, Object arg1, Object arg2) { + + throw new UnsupportedOperationException("Unimplemented method 'trace'"); + } + + @Override + public void trace(Marker marker, String format, Object... argArray) { + + throw new UnsupportedOperationException("Unimplemented method 'trace'"); + } + + @Override + public void trace(Marker marker, String msg, Throwable t) { + + throw new UnsupportedOperationException("Unimplemented method 'trace'"); + } + + @Override + public void debug(String format, Object arg) { + + throw new UnsupportedOperationException("Unimplemented method 'debug'"); + } + + @Override + public void debug(String format, Object arg1, Object arg2) { + + throw new UnsupportedOperationException("Unimplemented method 'debug'"); + } + + @Override + public boolean isDebugEnabled(Marker marker) { + + throw new UnsupportedOperationException("Unimplemented method 'isDebugEnabled'"); + } + + @Override + public void debug(Marker marker, String msg) { + + throw new UnsupportedOperationException("Unimplemented method 'debug'"); + } + + @Override + public void debug(Marker marker, String format, Object arg) { + + throw new UnsupportedOperationException("Unimplemented method 'debug'"); + } + + @Override + public void debug(Marker marker, String format, Object arg1, Object arg2) { + + throw new UnsupportedOperationException("Unimplemented method 'debug'"); + } + + @Override + public void debug(Marker marker, String format, Object... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'debug'"); + } + + @Override + public void debug(Marker marker, String msg, Throwable t) { + + throw new UnsupportedOperationException("Unimplemented method 'debug'"); + } + + @Override + public void info(String format, Object arg) { + + throw new UnsupportedOperationException("Unimplemented method 'info'"); + } + + @Override + public void info(String format, Object arg1, Object arg2) { + + throw new UnsupportedOperationException("Unimplemented method 'info'"); + } + + @Override + public void info(String msg, Throwable t) { + + throw new UnsupportedOperationException("Unimplemented method 'info'"); + } + + @Override + public boolean isInfoEnabled(Marker marker) { + + throw new UnsupportedOperationException("Unimplemented method 'isInfoEnabled'"); + } + + @Override + public void info(Marker marker, String msg) { + + throw new UnsupportedOperationException("Unimplemented method 'info'"); + } + + @Override + public void info(Marker marker, String format, Object arg) { + + throw new UnsupportedOperationException("Unimplemented method 'info'"); + } + + @Override + public void info(Marker marker, String format, Object arg1, Object arg2) { + + throw new UnsupportedOperationException("Unimplemented method 'info'"); + } + + @Override + public void info(Marker marker, String format, Object... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'info'"); + } + + @Override + public void info(Marker marker, String msg, Throwable t) { + + throw new UnsupportedOperationException("Unimplemented method 'info'"); + } + + @Override + public void warn(String format, Object arg) { + + throw new UnsupportedOperationException("Unimplemented method 'warn'"); + } + + @Override + public void warn(String format, Object arg1, Object arg2) { + + throw new UnsupportedOperationException("Unimplemented method 'warn'"); + } + + @Override + public boolean isWarnEnabled(Marker marker) { + + throw new UnsupportedOperationException("Unimplemented method 'isWarnEnabled'"); + } + + @Override + public void warn(Marker marker, String msg) { + + throw new UnsupportedOperationException("Unimplemented method 'warn'"); + } + + @Override + public void warn(Marker marker, String format, Object arg) { + + throw new UnsupportedOperationException("Unimplemented method 'warn'"); + } + + @Override + public void warn(Marker marker, String format, Object arg1, Object arg2) { + + throw new UnsupportedOperationException("Unimplemented method 'warn'"); + } + + @Override + public void warn(Marker marker, String format, Object... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'warn'"); + } + + @Override + public void warn(Marker marker, String msg, Throwable t) { + + throw new UnsupportedOperationException("Unimplemented method 'warn'"); + } + + @Override + public void error(String format, Object arg) { + + throw new UnsupportedOperationException("Unimplemented method 'error'"); + } + + @Override + public void error(String format, Object arg1, Object arg2) { + + throw new UnsupportedOperationException("Unimplemented method 'error'"); + } + + @Override + public boolean isErrorEnabled(Marker marker) { + + throw new UnsupportedOperationException("Unimplemented method 'isErrorEnabled'"); + } + + @Override + public void error(Marker marker, String msg) { + + throw new UnsupportedOperationException("Unimplemented method 'error'"); + } + + @Override + public void error(Marker marker, String format, Object arg) { + + throw new UnsupportedOperationException("Unimplemented method 'error'"); + } + + @Override + public void error(Marker marker, String format, Object arg1, Object arg2) { + + throw new UnsupportedOperationException("Unimplemented method 'error'"); + } + + @Override + public void error(Marker marker, String format, Object... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'error'"); + } + + @Override + public void error(Marker marker, String msg, Throwable t) { + + throw new UnsupportedOperationException("Unimplemented method 'error'"); + } + + @Override + public void warn(Locale locale, EELFResolvableResourceEnum resource, Throwable th, String... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'warn'"); + } + + @Override + public void info(Locale locale, EELFResolvableResourceEnum resource, Throwable th, String... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'info'"); + } + + @Override + public void debug(Locale locale, EELFResolvableResourceEnum resource, Throwable th, String... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'debug'"); + } + + @Override + public void error(Locale locale, EELFResolvableResourceEnum resource, Throwable th, String... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'error'"); + } + + @Override + public void trace(Locale locale, EELFResolvableResourceEnum resource, Throwable th, String... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'trace'"); + } + + @Override + public void warn(Locale locale, EELFResolvableResourceEnum resource, String... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'warn'"); + } + + @Override + public void info(Locale locale, EELFResolvableResourceEnum resource, String... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'info'"); + } + + @Override + public void debug(Locale locale, EELFResolvableResourceEnum resource, String... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'debug'"); + } + + @Override + public void error(Locale locale, EELFResolvableResourceEnum resource, String... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'error'"); + } + + @Override + public void trace(Locale locale, EELFResolvableResourceEnum resource, String... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'trace'"); + } + + @Override + public void warn(EELFResolvableResourceEnum resource, String... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'warn'"); + } + + @Override + public void info(EELFResolvableResourceEnum resource, String... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'info'"); + } + + @Override + public void debug(EELFResolvableResourceEnum resource, String... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'debug'"); + } + + @Override + public void error(EELFResolvableResourceEnum resource, String... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'error'"); + } + + @Override + public void trace(EELFResolvableResourceEnum resource, String... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'trace'"); + } + + @Override + public void warn(EELFResolvableResourceEnum resource, Throwable th, String... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'warn'"); + } + + @Override + public void info(EELFResolvableResourceEnum resource, Throwable th, String... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'info'"); + } + + @Override + public void debug(EELFResolvableResourceEnum resource, Throwable th, String... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'debug'"); + } + + @Override + public void error(EELFResolvableResourceEnum resource, Throwable th, String... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'error'"); + } + + @Override + public void trace(EELFResolvableResourceEnum resource, Throwable th, String... arguments) { + + throw new UnsupportedOperationException("Unimplemented method 'trace'"); + } } } -- cgit 1.2.3-korg