stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im...@apache.org
Subject [1/5] stratos git commit: Refining life cycle state manger logs
Date Mon, 29 Dec 2014 07:28:03 GMT
Repository: stratos
Updated Branches:
  refs/heads/master 35f156d48 -> 2e3deabc5


Refining life cycle state manger logs


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/53c04a56
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/53c04a56
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/53c04a56

Branch: refs/heads/master
Commit: 53c04a56f028a656cb51f6481f13a8c9bffcb380
Parents: 35f156d
Author: Imesh Gunaratne <imesh@apache.org>
Authored: Sun Dec 28 23:30:52 2014 +0530
Committer: Imesh Gunaratne <imesh@apache.org>
Committed: Mon Dec 29 12:57:55 2014 +0530

----------------------------------------------------------------------
 .../lifecycle/LifeCycleStateManager.java        | 21 +++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/53c04a56/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/lifecycle/LifeCycleStateManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/lifecycle/LifeCycleStateManager.java
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/lifecycle/LifeCycleStateManager.java
index f5eb859..2586142 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/lifecycle/LifeCycleStateManager.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/lifecycle/LifeCycleStateManager.java
@@ -41,8 +41,11 @@ public class LifeCycleStateManager<T extends LifeCycleState> implements
Serializ
         this.identifier = identifier;
         stateStack = new Stack<T>();
         stateStack.push(initialState);
-        log.info("Life Cycle State Manager started for Element [ " + identifier +
-                " ], initial state: " + initialState.toString());
+
+        if(log.isDebugEnabled()) {
+            log.debug(String.format("Lifecycle state manager initialized: [identifier] %s
[state] %s",
+                    identifier, initialState.toString()));
+        }
     }
 
     /**
@@ -84,13 +87,13 @@ public class LifeCycleStateManager<T extends LifeCycleState> implements
Serializ
             stateStack.push(nextState);
             stateChanged = true;
             if(log.isDebugEnabled()) {
-                log.debug("Element [" + identifier + "]'s lifecycle state changed from ["
+
-                        getPreviousState() + "] to [" + getCurrentState() + "]");
+                log.debug(String.format("Lifecycle state changed: [identifier] %s [prev-state]
%s [current-state] %s ",
+                        getIdentifier(), getPreviousState(), getCurrentState()));
             }
         } else {
             if (log.isDebugEnabled()) {
-                log.debug("Element [" + identifier +"]'s lifecycle state has been " +
-                        "already updated to [" + nextState + "]");
+                log.debug(String.format("Lifecycle state already changed: [identifier] %s
[prev-state] %s " +
+                                "[current-state] %s ", getIdentifier(), getPreviousState(),
getCurrentState()));
             }
         }
         if (log.isDebugEnabled()) {
@@ -133,11 +136,11 @@ public class LifeCycleStateManager<T extends LifeCycleState> implements
Serializ
     private static <T extends LifeCycleState> void printStateTransitions (Stack<T>
stateStack, String id) {
 
         // print all transitions till now
-        StringBuilder stateTransitions = new StringBuilder("Transitioned States for " + id
+ ":  [ START --> ");
+        StringBuilder stateTransitions = new StringBuilder("Transitioned states for " + id
+ ": [START]");
         for (T aStateStack : stateStack) {
-            stateTransitions.append(aStateStack).append(" --> ");
+            stateTransitions.append(aStateStack);
         }
-        stateTransitions.append(" END ]");
+        stateTransitions.append("[END]");
         log.debug(stateTransitions);
     }
 


Mime
View raw message