diff options
author | Magnusen, Drew (dm741q) <dm741q@att.com> | 2017-08-31 11:32:51 -0500 |
---|---|---|
committer | Magnusen, Drew (dm741q) <dm741q@att.com> | 2017-09-14 14:04:12 -0500 |
commit | 0e87901898a23bfdfc993edb312488006299d01a (patch) | |
tree | f7e665459d07239d0d997955d5eab5dbefada0db /integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java | |
parent | e9b5f957f3c27c0a225d7b8fa16a220c5c98c746 (diff) |
Changed logger to slf4j
Changed all instances of Sys.out or PolicyLogger to
slf4j.
Issue-ID: POLICY-178
Change-Id: Ia91af1deb18a9b5c466f6f8a6c546c17c54e14ad
Signed-off-by: Magnusen, Drew (dm741q) <dm741q@att.com>
Diffstat (limited to 'integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java')
-rw-r--r-- | integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java index 03f6f4e3..3f690187 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java @@ -24,15 +24,15 @@ import java.util.*; import org.onap.policy.common.im.StateElement; -import org.onap.policy.common.im.StateManagement; -import org.onap.policy.common.logging.flexlogger.FlexLogger; -import org.onap.policy.common.logging.flexlogger.Logger; +import org.onap.policy.common.im.StateManagement; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * The StateTransition class coordinates all state transitions. */ public class StateTransition { - private static final Logger logger = FlexLogger.getLogger(StateTransition.class); + private static final Logger logger = LoggerFactory.getLogger(StateTransition.class); public static final String ADMIN_STATE = "adminState"; public static final String OPERATION_STATE = "opState"; @@ -48,14 +48,18 @@ public class StateTransition { */ public StateTransition() throws StateTransitionException { - logger.debug("StateTransition constructor"); + if(logger.isDebugEnabled()){ + logger.debug("StateTransition constructor"); + } try { - logger.debug("Load StateTable started"); + if(logger.isDebugEnabled()){ + logger.debug("Load StateTable started"); + } setupStateTable(); } catch(Exception ex) { - logger.debug(ex); + logger.error("StateTransition threw exception.", ex); throw new StateTransitionException("StateTransition Exception: " + ex.toString()); } } @@ -73,9 +77,17 @@ public class StateTransition { public StateElement getEndingState(String adminState, String opState, String availStatus, String standbyStatus, String actionName) throws StateTransitionException { - logger.info("getEndingState"); - logger.info("adminState=[" + adminState + "], opState=[" + opState + "], availStatus=[" + - availStatus + "], standbyStatus=[" + standbyStatus + "], actionName=[" + actionName + "]"); + if(logger.isDebugEnabled()){ + logger.debug("getEndingState"); + } + if(logger.isDebugEnabled()){ + logger.debug("adminState=[{}], opState=[{}], availStatus=[{}], standbyStatus=[{}], actionName[{}]", + adminState, + opState, + availStatus, + standbyStatus, + actionName); + } if(availStatus==null){ availStatus="null"; } @@ -124,7 +136,9 @@ public class StateTransition { availStatus2 = availStatus.replace(",", "."); } String key = adminState + "," + opState + "," + availStatus2 + "," + standbyStatus + "," + actionName; - logger.debug("Ending State search key: " + key); + if(logger.isDebugEnabled()){ + logger.debug("Ending State search key: {}", key); + } String value = StateTable.get(key); if (value != null) { @@ -143,17 +157,17 @@ public class StateTransition { stateElement.displayStateElement(); } catch(Exception ex) { - logger.error("String split exception: " + ex); + logger.error("String split exception: {}", ex.toString(), ex); } } else { String msg = "Ending state not found, adminState=[" + adminState + "], opState=[" + opState + "], availStatus=[" + availStatus + "], standbyStatus=[" + standbyStatus + "], actionName=[" + actionName + "]"; - logger.error(msg); + logger.error("{}", msg); throw new StateTransitionException(msg); } } catch (Exception ex) { - logger.debug(ex); + logger.error("StateTransition threw exception.", ex); throw new StateTransitionException("Exception: " + ex.toString() + ", adminState=[" + adminState + "], opState=[" + opState + "], availStatus=[" + availStatus + "], standbyStatus=[" + standbyStatus + "], actionName=[" + actionName + "]"); } @@ -720,7 +734,10 @@ public class StateTransition { while(iter.hasNext()) { Map.Entry<?, ?> me = (Map.Entry<?, ?>)iter.next(); - logger.debug((String)me.getKey() + ((String)me.getValue()).replace(".", ",")); + String key = (String)me.getKey() + ((String)me.getValue()).replace(".", ","); + if(logger.isDebugEnabled()){ + logger.debug("{}", key); + } } } } |