diff options
Diffstat (limited to 'ecomp-sdk')
-rw-r--r-- | ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegate.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegate.java b/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegate.java index b28bcf5a..f74571b5 100644 --- a/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegate.java +++ b/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegate.java @@ -47,6 +47,7 @@ import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME; import java.net.InetAddress; import java.text.MessageFormat; import java.text.SimpleDateFormat; +import java.util.Arrays; import java.util.Date; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; @@ -134,7 +135,14 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { } if (logger.isErrorEnabled()) { - logger.log(level, msg, null, arguments); + Object[] transformedArgs = Arrays.stream(arguments).map(argument -> { + if (argument instanceof Throwable) + return ((Throwable) argument).getMessage(); + else + return argument; + }).toArray(); + logger.log(level, msg, null, transformedArgs); + debugLogger.error(msg, arguments); } else { logger.log(level, msg, th, arguments); } @@ -350,7 +358,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { * @param th */ public void error(EELFLogger logger, String msg, Throwable th) { - logWrite(logger, Level.ERROR, msg, null); + logWrite(logger, Level.ERROR, msg, null, th); } /** @@ -407,6 +415,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { } catch (Exception e) { validateErrorLogFields(); errorLogger.error("logEcompError failed " + e.getMessage()); + debugLogger.error("logEcompError failed " , e); } finally { MDC.remove(LoggerProperties.ERROR_CODE); MDC.remove(LoggerProperties.ERROR_DESCRIPTION); @@ -446,6 +455,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { } catch (Exception e) { validateErrorLogFields(); errorLogger.error("setGlobalLoggingContext failed " + e.getMessage()); + debugLogger.error("setGlobalLoggingContext failed ", e); } } @@ -548,6 +558,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { } catch (Exception e) { validateErrorLogFields(); errorLogger.error("calculateDateTimeDifference failed " + e.getMessage()); + debugLogger.error("calculateDateTimeDifference failed ", e); } } } |