aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/onap/music/eelf/logging/EELFLoggerDelegate.java33
-rw-r--r--src/main/java/org/onap/music/lockingservice/MusicLockingService.java3
-rw-r--r--src/main/java/org/onap/music/main/MusicCore.java6
3 files changed, 35 insertions, 7 deletions
diff --git a/src/main/java/org/onap/music/eelf/logging/EELFLoggerDelegate.java b/src/main/java/org/onap/music/eelf/logging/EELFLoggerDelegate.java
index 0c290b6f..bb28d172 100644
--- a/src/main/java/org/onap/music/eelf/logging/EELFLoggerDelegate.java
+++ b/src/main/java/org/onap/music/eelf/logging/EELFLoggerDelegate.java
@@ -228,10 +228,23 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
*
* @param logger
* @param msg
+ *
+ * @deprecated use {@link #error(EELF, Exception)} instead
*/
+ @Deprecated
public void error(EELFLogger logger, String msg) {
logger.error(className+ " - " + msg);
}
+
+ /**
+ * Logs a message at error level.
+ *
+ * @param logger
+ * @param msg
+ */
+ public void error(EELFLogger logger, Exception e) {
+ logger.error(className+ " - ", e);
+ }
/**
* Logs a message with parameters at error level.
@@ -239,9 +252,23 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
* @param logger
* @param msg
* @param arguments
+ *
+ * @deprecated use {@link #error(EELF, Exception, Object...)} instead
*/
+ @Deprecated
public void error(EELFLogger logger, String msg, Object... arguments) {
- logger.warn(msg, arguments);
+ logger.error(msg, arguments);
+ }
+
+ /**
+ * Logs a message with parameters at error level.
+ *
+ * @param logger
+ * @param msg
+ * @param arguments
+ */
+ public void error(EELFLogger logger, Exception e, Object... arguments) {
+ logger.error("Exception", e, arguments);
}
/**
@@ -252,7 +279,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
* @param th
*/
public void error(EELFLogger logger, String msg, Throwable th) {
- logger.warn(msg, th);
+ logger.error(msg, th);
}
/**
@@ -261,7 +288,9 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
* @param logger
* @param msg
* @param severtiy
+ * @deprecated use {@link #error(EELF, Exception)} instead
*/
+ @Deprecated
public void error(EELFLogger logger, String msg, Object /* AlarmSeverityEnum */ severtiy) {
logger.error(msg);
}
diff --git a/src/main/java/org/onap/music/lockingservice/MusicLockingService.java b/src/main/java/org/onap/music/lockingservice/MusicLockingService.java
index 097055ba..a75480ae 100644
--- a/src/main/java/org/onap/music/lockingservice/MusicLockingService.java
+++ b/src/main/java/org/onap/music/lockingservice/MusicLockingService.java
@@ -103,8 +103,7 @@ public class MusicLockingService implements Watcher {
try{
data = zkLockHandle.getNodeData(lockName);
}catch (Exception ex){
- logger.error("Error", ex);
- logger.error(EELFLoggerDelegate.errorLogger, ex.getMessage(),AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, ex,AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
}
if(data !=null)
return MusicLockState.deSerialize(data);
diff --git a/src/main/java/org/onap/music/main/MusicCore.java b/src/main/java/org/onap/music/main/MusicCore.java
index 9f7b060b..98696bab 100644
--- a/src/main/java/org/onap/music/main/MusicCore.java
+++ b/src/main/java/org/onap/music/main/MusicCore.java
@@ -189,7 +189,7 @@ public class MusicCore {
logger.info(EELFLoggerDelegate.applicationLogger,"Time taken to get lock state:" + (end - start) + " ms");
return mls;
} catch (NullPointerException | MusicLockingException e) {
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.INVALIDLOCK,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,e, AppMessages.INVALIDLOCK,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
}
return null;
}
@@ -213,9 +213,9 @@ public class MusicCore {
mls = releaseLock(currentLockHolder, voluntaryRelease);
}
}
- } else
+ } else {
logger.error(EELFLoggerDelegate.errorLogger,key, AppMessages.INVALIDLOCK,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
-
+ }
/*
* call the traditional acquire lock now and if the result returned is true, set the
* begin time-stamp and lease period