From 68497017062350f49c0aa28d8a3cf79e9a77aa42 Mon Sep 17 00:00:00 2001 From: Kishore Reddy Dwaram Date: Tue, 27 Oct 2020 17:28:35 -0400 Subject: Checking arguments for error logs Issue-ID: PORTAL-1008 Signed-off-by: Kishore Reddy Dwaram Change-Id: Ia1c118713b046794e3b1d4a4f71d3ffd469c2677 --- .../core/logging/logic/EELFLoggerDelegate.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 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 f74571b5..64ca1ab1 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 @@ -135,13 +135,18 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { } if (logger.isErrorEnabled()) { - 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); + Object[] transformedArgs = null; + if (arguments != null) { + transformedArgs = Arrays.stream(arguments).map(argument -> { + if (argument instanceof Throwable) + return ((Throwable) argument).getMessage(); + else + return argument; + }).toArray(); + logger.log(level, msg, null, transformedArgs); + } else { + logger.log(level, msg, null); + } debugLogger.error(msg, arguments); } else { logger.log(level, msg, th, arguments); -- cgit 1.2.3-korg