summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKishore Reddy Dwaram <kishore.reddy.dwaram@att.com>2020-10-27 17:28:35 -0400
committerKishore Reddy Dwaram <kishore.reddy.dwaram@att.com>2020-10-27 17:29:24 -0400
commit68497017062350f49c0aa28d8a3cf79e9a77aa42 (patch)
tree9203e4760a538aca4272b4897d56d7b71f5a1ac4
parentf05c67c2d001d14b0ee564cd7650eea974e578e0 (diff)
Checking arguments for error logs
Issue-ID: PORTAL-1008 Signed-off-by: Kishore Reddy Dwaram <kishore.reddy.dwaram@att.com> Change-Id: Ia1c118713b046794e3b1d4a4f71d3ffd469c2677
-rw-r--r--ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegate.java19
1 files 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);