diff options
author | Charles Cole <cc847m@att.com> | 2017-12-04 14:47:04 -0600 |
---|---|---|
committer | Charles Cole <cc847m@att.com> | 2017-12-04 21:09:13 +0000 |
commit | da75a5e8cd3e64fb8e7efa8db18e1a488870d0dc (patch) | |
tree | 158dda481852435ea14c12404815d510b21be444 /common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger4J.java | |
parent | e73c82943d4a1e6dffd7712837d50e58c01bef7b (diff) |
Fix sonar issues in ONAP-logging
Fixed the Sonar issues in ONAP-logging that required minimal refactoring
of the code. Many of the System.out and System.err issues I did not
fix, as I don't know what loggers to use.
Issue-ID: POLICY-458
Change-Id: I8eccb932b350a170b9cd680b90009e6612a0abcd
Signed-off-by: Charles Cole <cc847m@att.com>
Diffstat (limited to 'common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger4J.java')
-rw-r--r-- | common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger4J.java | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger4J.java b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger4J.java index 9fcd47af..746012d1 100644 --- a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger4J.java +++ b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger4J.java @@ -182,12 +182,8 @@ public class Logger4J implements org.onap.policy.common.logging.flexlogger.Logge * @return boolean */ @Override - public boolean isAuditEnabled(){ - if(PolicyLogger.getAuditLevel() != null && PolicyLogger.getAuditLevel().toString().equals(Level.OFF.toString())){ - return false; - }else { - return true; - } + public boolean isAuditEnabled(){ + return !(PolicyLogger.getAuditLevel() != null && PolicyLogger.getAuditLevel().toString().equals(Level.OFF.toString())); } /** @@ -196,11 +192,7 @@ public class Logger4J implements org.onap.policy.common.logging.flexlogger.Logge */ @Override public boolean isMetricsEnabled(){ - if(PolicyLogger.getMetricsLevel() != null && PolicyLogger.getMetricsLevel().toString().equals(Level.OFF.toString())){ - return false; - }else { - return true; - } + return !(PolicyLogger.getMetricsLevel() != null && PolicyLogger.getMetricsLevel().toString().equals(Level.OFF.toString())); } /** @@ -343,12 +335,13 @@ public class Logger4J implements org.onap.policy.common.logging.flexlogger.Logge * @param transId */ @Override - public String postMDCInfoForEvent(String transId) { - if(transId == null || transId.isEmpty()){ - transId = UUID.randomUUID().toString(); + public String postMDCInfoForEvent(String transId) { + String transactionId = transId; + if(transactionId == null || transactionId.isEmpty()){ + transactionId = UUID.randomUUID().toString(); } - return transId; + return transactionId; } /** |