cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject [28/35] git commit: updated refs/heads/master to 8bc0294
Date Mon, 31 Aug 2015 06:01:48 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java b/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
index 8dad8ff..ecf3aac 100644
--- a/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
+++ b/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
@@ -46,6 +46,7 @@ import org.apache.cloudstack.framework.config.ConfigKey;
 import org.apache.cloudstack.framework.config.Configurable;
 import org.apache.cloudstack.managed.context.ManagedContextRunnable;
 import org.apache.cloudstack.utils.identity.ManagementServerNode;
+import org.apache.log4j.Logger;
 
 import com.cloud.cluster.dao.ManagementServerHostDao;
 import com.cloud.cluster.dao.ManagementServerHostPeerDao;
@@ -69,6 +70,7 @@ import com.cloud.utils.net.NetUtils;
 
 @Local(value = {ClusterManager.class})
 public class ClusterManagerImpl extends ManagerBase implements ClusterManager, Configurable {
+    private static final Logger s_logger = Logger.getLogger(ClusterManagerImpl.class);
 
     private static final int EXECUTOR_SHUTDOWN_TIMEOUT = 1000; // 1 second
     private static final int DEFAULT_OUTGOING_WORKERS = 5;
@@ -165,7 +167,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
         }
 
         for (final ClusterServiceRequestPdu pdu : candidates) {
-            logger.warn("Cancel cluster request PDU to peer: " + strPeer + ", pdu: " + pdu.getJsonPackage());
+            s_logger.warn("Cancel cluster request PDU to peer: " + strPeer + ", pdu: " + pdu.getJsonPackage());
             synchronized (pdu) {
                 pdu.notifyAll();
             }
@@ -249,13 +251,13 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                     try {
                         peerService = getPeerService(pdu.getDestPeer());
                     } catch (final RemoteException e) {
-                        logger.error("Unable to get cluster service on peer : " + pdu.getDestPeer());
+                        s_logger.error("Unable to get cluster service on peer : " + pdu.getDestPeer());
                     }
 
                     if (peerService != null) {
                         try {
-                            if (logger.isDebugEnabled()) {
-                                logger.debug("Cluster PDU " + getSelfPeerName() + " -> " + pdu.getDestPeer() + ". agent: " + pdu.getAgentId() + ", pdu seq: " +
+                            if (s_logger.isDebugEnabled()) {
+                                s_logger.debug("Cluster PDU " + getSelfPeerName() + " -> " + pdu.getDestPeer() + ". agent: " + pdu.getAgentId() + ", pdu seq: " +
                                         pdu.getSequenceId() + ", pdu ack seq: " + pdu.getAckSequenceId() + ", json: " + pdu.getJsonPackage());
                             }
 
@@ -265,8 +267,8 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                             final String strResult = peerService.execute(pdu);
                             profiler.stop();
 
-                            if (logger.isDebugEnabled()) {
-                                logger.debug("Cluster PDU " + getSelfPeerName() + " -> " + pdu.getDestPeer() + " completed. time: " +
+                            if (s_logger.isDebugEnabled()) {
+                                s_logger.debug("Cluster PDU " + getSelfPeerName() + " -> " + pdu.getDestPeer() + " completed. time: " +
                                         profiler.getDurationInMillis() + "ms. agent: " + pdu.getAgentId() + ", pdu seq: " + pdu.getSequenceId() +
                                         ", pdu ack seq: " + pdu.getAckSequenceId() + ", json: " + pdu.getJsonPackage());
                             }
@@ -277,15 +279,15 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
 
                         } catch (final RemoteException e) {
                             invalidatePeerService(pdu.getDestPeer());
-                            if (logger.isInfoEnabled()) {
-                                logger.info("Exception on remote execution, peer: " + pdu.getDestPeer() + ", iteration: " + i + ", exception message :" +
+                            if (s_logger.isInfoEnabled()) {
+                                s_logger.info("Exception on remote execution, peer: " + pdu.getDestPeer() + ", iteration: " + i + ", exception message :" +
                                         e.getMessage());
                             }
                         }
                     }
                 }
             } catch (final Throwable e) {
-                logger.error("Unexcpeted exception: ", e);
+                s_logger.error("Unexcpeted exception: ", e);
             }
         }
     }
@@ -309,7 +311,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                                     requestPdu.notifyAll();
                                 }
                             } else {
-                                logger.warn("Original request has already been cancelled. pdu: " + pdu.getJsonPackage());
+                                s_logger.warn("Original request has already been cancelled. pdu: " + pdu.getJsonPackage());
                             }
                         } else {
                             String result = _dispatcher.dispatch(pdu);
@@ -331,7 +333,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                     }
                 });
             } catch (final Throwable e) {
-                logger.error("Unexcpeted exception: ", e);
+                s_logger.error("Unexcpeted exception: ", e);
             }
         }
     }
@@ -364,12 +366,12 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                 continue; // Skip myself.
             }
             try {
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Forwarding " + cmds + " to " + peer.getMsid());
+                if (s_logger.isDebugEnabled()) {
+                    s_logger.debug("Forwarding " + cmds + " to " + peer.getMsid());
                 }
                 executeAsync(peerName, agentId, cmds, true);
             } catch (final Exception e) {
-                logger.warn("Caught exception while talkign to " + peer.getMsid());
+                s_logger.warn("Caught exception while talkign to " + peer.getMsid());
             }
         }
     }
@@ -386,8 +388,8 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
 
     @Override
     public String execute(final String strPeer, final long agentId, final String cmds, final boolean stopOnError) {
-        if (logger.isDebugEnabled()) {
-            logger.debug(getSelfPeerName() + " -> " + strPeer + "." + agentId + " " + cmds);
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug(getSelfPeerName() + " -> " + strPeer + "." + agentId + " " + cmds);
         }
 
         final ClusterServiceRequestPdu pdu = new ClusterServiceRequestPdu();
@@ -406,8 +408,8 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
             }
         }
 
-        if (logger.isDebugEnabled()) {
-            logger.debug(getSelfPeerName() + " -> " + strPeer + "." + agentId + " completed. result: " + pdu.getResponseResult());
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug(getSelfPeerName() + " -> " + strPeer + "." + agentId + " completed. result: " + pdu.getResponseResult());
         }
 
         if (pdu.getResponseResult() != null && pdu.getResponseResult().length() > 0) {
@@ -436,7 +438,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
         // Note : we don't check duplicates
         synchronized (_listeners) {
 
-            logger.info("register cluster listener " + listener.getClass());
+            s_logger.info("register cluster listener " + listener.getClass());
 
             _listeners.add(listener);
         }
@@ -445,18 +447,18 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
     @Override
     public void unregisterListener(final ClusterManagerListener listener) {
         synchronized (_listeners) {
-            logger.info("unregister cluster listener " + listener.getClass());
+            s_logger.info("unregister cluster listener " + listener.getClass());
 
             _listeners.remove(listener);
         }
     }
 
     public void notifyNodeJoined(final List<ManagementServerHostVO> nodeList) {
-        if (logger.isDebugEnabled()) {
-            logger.debug("Notify management server node join to listeners.");
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Notify management server node join to listeners.");
 
             for (final ManagementServerHostVO mshost : nodeList) {
-                logger.debug("Joining node, IP: " + mshost.getServiceIP() + ", msid: " + mshost.getMsid());
+                s_logger.debug("Joining node, IP: " + mshost.getServiceIP() + ", msid: " + mshost.getMsid());
             }
         }
 
@@ -470,13 +472,13 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
     }
 
     public void notifyNodeLeft(final List<ManagementServerHostVO> nodeList) {
-        if (logger.isDebugEnabled()) {
-            logger.debug("Notify management server node left to listeners.");
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Notify management server node left to listeners.");
         }
 
         for (final ManagementServerHostVO mshost : nodeList) {
-            if (logger.isDebugEnabled()) {
-                logger.debug("Leaving node, IP: " + mshost.getServiceIP() + ", msid: " + mshost.getMsid());
+            if (s_logger.isDebugEnabled()) {
+                s_logger.debug("Leaving node, IP: " + mshost.getServiceIP() + ", msid: " + mshost.getMsid());
             }
             cancelClusterRequestToPeer(String.valueOf(mshost.getMsid()));
         }
@@ -491,8 +493,8 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
     }
 
     public void notifyNodeIsolated() {
-        if (logger.isDebugEnabled()) {
-            logger.debug("Notify management server node isolation to listeners");
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Notify management server node isolation to listeners");
         }
 
         synchronized (_listeners) {
@@ -547,16 +549,16 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
 
                         profilerHeartbeatUpdate.start();
                         txn.transitToUserManagedConnection(getHeartbeatConnection());
-                        if (logger.isTraceEnabled()) {
-                            logger.trace("Cluster manager heartbeat update, id:" + _mshostId);
+                        if (s_logger.isTraceEnabled()) {
+                            s_logger.trace("Cluster manager heartbeat update, id:" + _mshostId);
                         }
 
                         _mshostDao.update(_mshostId, _runId, DateUtil.currentGMTTime());
                         profilerHeartbeatUpdate.stop();
 
                         profilerPeerScan.start();
-                        if (logger.isTraceEnabled()) {
-                            logger.trace("Cluster manager peer-scan, id:" + _mshostId);
+                        if (s_logger.isTraceEnabled()) {
+                            s_logger.trace("Cluster manager peer-scan, id:" + _mshostId);
                         }
 
                         if (!_peerScanInited) {
@@ -571,18 +573,18 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                         profiler.stop();
 
                         if (profiler.getDurationInMillis() >= HeartbeatInterval.value()) {
-                            if (logger.isDebugEnabled()) {
-                                logger.debug("Management server heartbeat takes too long to finish. profiler: " + profiler.toString() + ", profilerHeartbeatUpdate: " +
+                            if (s_logger.isDebugEnabled()) {
+                                s_logger.debug("Management server heartbeat takes too long to finish. profiler: " + profiler.toString() + ", profilerHeartbeatUpdate: " +
                                         profilerHeartbeatUpdate.toString() + ", profilerPeerScan: " + profilerPeerScan.toString());
                             }
                         }
                     }
 
                 } catch (final CloudRuntimeException e) {
-                    logger.error("Runtime DB exception ", e.getCause());
+                    s_logger.error("Runtime DB exception ", e.getCause());
 
                     if (e.getCause() instanceof ClusterInvalidSessionException) {
-                        logger.error("Invalid cluster session found, fence it");
+                        s_logger.error("Invalid cluster session found, fence it");
                         queueNotification(new ClusterManagerMessage(ClusterManagerMessage.MessageType.nodeIsolated));
                     }
 
@@ -592,7 +594,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                 } catch (final ActiveFencingException e) {
                     queueNotification(new ClusterManagerMessage(ClusterManagerMessage.MessageType.nodeIsolated));
                 } catch (final Throwable e) {
-                    logger.error("Unexpected exception in cluster heartbeat", e);
+                    s_logger.error("Unexpected exception in cluster heartbeat", e);
                     if (isRootCauseConnectionRelated(e.getCause())) {
                         invalidHeartbeatConnection();
                     }
@@ -631,7 +633,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
             if (conn != null) {
                 _heartbeatConnection.reset(conn);
             } else {
-                logger.error("DB communication problem detected, fence it");
+                s_logger.error("DB communication problem detected, fence it");
                 queueNotification(new ClusterManagerMessage(ClusterManagerMessage.MessageType.nodeIsolated));
             }
             // The stand-alone connection does not have to be closed here because there will be another reference to it.
@@ -664,11 +666,11 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
 
                                     profiler.stop();
                                     if (profiler.getDurationInMillis() > 1000) {
-                                        if (logger.isDebugEnabled()) {
-                                            logger.debug("Notifying management server join event took " + profiler.getDurationInMillis() + " ms");
+                                        if (s_logger.isDebugEnabled()) {
+                                            s_logger.debug("Notifying management server join event took " + profiler.getDurationInMillis() + " ms");
                                         }
                                     } else {
-                                        logger.warn("Notifying management server join event took " + profiler.getDurationInMillis() + " ms");
+                                        s_logger.warn("Notifying management server join event took " + profiler.getDurationInMillis() + " ms");
                                     }
                                 }
                                 break;
@@ -682,11 +684,11 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
 
                                     profiler.stop();
                                     if (profiler.getDurationInMillis() > 1000) {
-                                        if (logger.isDebugEnabled()) {
-                                            logger.debug("Notifying management server leave event took " + profiler.getDurationInMillis() + " ms");
+                                        if (s_logger.isDebugEnabled()) {
+                                            s_logger.debug("Notifying management server leave event took " + profiler.getDurationInMillis() + " ms");
                                         }
                                     } else {
-                                        logger.warn("Notifying management server leave event took " + profiler.getDurationInMillis() + " ms");
+                                        s_logger.warn("Notifying management server leave event took " + profiler.getDurationInMillis() + " ms");
                                     }
                                 }
                                 break;
@@ -701,7 +703,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                             }
 
                         } catch (final Throwable e) {
-                            logger.warn("Unexpected exception during cluster notification. ", e);
+                            s_logger.warn("Unexpected exception during cluster notification. ", e);
                         }
                     }
 
@@ -768,18 +770,18 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
         if (orphanList.size() > 0) {
             for (final Long orphanMsid : orphanList) {
                 // construct fake ManagementServerHostVO based on orphan MSID
-                logger.info("Add orphan management server msid found in host table to initial clustering notification, orphan msid: " + orphanMsid);
+                s_logger.info("Add orphan management server msid found in host table to initial clustering notification, orphan msid: " + orphanMsid);
                 inactiveList.add(new ManagementServerHostVO(orphanMsid, 0, "orphan", 0, new Date()));
             }
         } else {
-            logger.info("We are good, no orphan management server msid in host table is found");
+            s_logger.info("We are good, no orphan management server msid in host table is found");
         }
 
         if (inactiveList.size() > 0) {
-            if (logger.isInfoEnabled()) {
-                logger.info("Found " + inactiveList.size() + " inactive management server node based on timestamp");
+            if (s_logger.isInfoEnabled()) {
+                s_logger.info("Found " + inactiveList.size() + " inactive management server node based on timestamp");
                 for (final ManagementServerHostVO host : inactiveList) {
-                    logger.info("management server node msid: " + host.getMsid() + ", name: " + host.getName() + ", service ip: " + host.getServiceIP() +
+                    s_logger.info("management server node msid: " + host.getMsid() + ", name: " + host.getName() + ", service ip: " + host.getServiceIP() +
                             ", version: " + host.getVersion());
                 }
             }
@@ -787,7 +789,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
             final List<ManagementServerHostVO> downHostList = new ArrayList<ManagementServerHostVO>();
             for (final ManagementServerHostVO host : inactiveList) {
                 if (!pingManagementNode(host)) {
-                    logger.warn("Management node " + host.getId() + " is detected inactive by timestamp and also not pingable");
+                    s_logger.warn("Management node " + host.getId() + " is detected inactive by timestamp and also not pingable");
                     downHostList.add(host);
                 }
             }
@@ -796,7 +798,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                 queueNotification(new ClusterManagerMessage(ClusterManagerMessage.MessageType.nodeRemoved, downHostList));
             }
         } else {
-            logger.info("No inactive management server node found");
+            s_logger.info("No inactive management server node found");
         }
     }
 
@@ -821,7 +823,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
             if (_mshostPeerDao.countStateSeenInPeers(_mshostId, _runId, ManagementServerHost.State.Down) > 0) {
                 final String msg =
                         "We have detected that at least one management server peer reports that this management server is down, perform active fencing to avoid split-brain situation";
-                logger.error(msg);
+                s_logger.error(msg);
                 throw new ActiveFencingException(msg);
             }
 
@@ -831,24 +833,24 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                 final ManagementServerHostVO current = getInListById(entry.getKey(), currentList);
                 if (current == null) {
                     if (entry.getKey().longValue() != _mshostId.longValue()) {
-                        if (logger.isDebugEnabled()) {
-                            logger.debug("Detected management node left, id:" + entry.getKey() + ", nodeIP:" + entry.getValue().getServiceIP());
+                        if (s_logger.isDebugEnabled()) {
+                            s_logger.debug("Detected management node left, id:" + entry.getKey() + ", nodeIP:" + entry.getValue().getServiceIP());
                         }
                         removedNodeList.add(entry.getValue());
                     }
                 } else {
                     if (current.getRunid() == 0) {
                         if (entry.getKey().longValue() != _mshostId.longValue()) {
-                            if (logger.isDebugEnabled()) {
-                                logger.debug("Detected management node left because of invalidated session, id:" + entry.getKey() + ", nodeIP:" +
+                            if (s_logger.isDebugEnabled()) {
+                                s_logger.debug("Detected management node left because of invalidated session, id:" + entry.getKey() + ", nodeIP:" +
                                         entry.getValue().getServiceIP());
                             }
                             invalidatedNodeList.add(entry.getValue());
                         }
                     } else {
                         if (entry.getValue().getRunid() != current.getRunid()) {
-                            if (logger.isDebugEnabled()) {
-                                logger.debug("Detected management node left and rejoined quickly, id:" + entry.getKey() + ", nodeIP:" + entry.getValue().getServiceIP());
+                            if (s_logger.isDebugEnabled()) {
+                                s_logger.debug("Detected management node left and rejoined quickly, id:" + entry.getKey() + ", nodeIP:" + entry.getValue().getServiceIP());
                             }
 
                             entry.getValue().setRunid(current.getRunid());
@@ -868,7 +870,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                 try {
                     JmxUtil.unregisterMBean("ClusterManager", "Node " + mshost.getId());
                 } catch (final Exception e) {
-                    logger.warn("Unable to deregiester cluster node from JMX monitoring due to exception " + e.toString());
+                    s_logger.warn("Unable to deregiester cluster node from JMX monitoring due to exception " + e.toString());
                 }
             }
 
@@ -883,15 +885,15 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
         while (it.hasNext()) {
             final ManagementServerHostVO mshost = it.next();
             if (!pingManagementNode(mshost)) {
-                logger.warn("Management node " + mshost.getId() + " is detected inactive by timestamp and also not pingable");
+                s_logger.warn("Management node " + mshost.getId() + " is detected inactive by timestamp and also not pingable");
                 _activePeers.remove(mshost.getId());
                 try {
                     JmxUtil.unregisterMBean("ClusterManager", "Node " + mshost.getId());
                 } catch (final Exception e) {
-                    logger.warn("Unable to deregiester cluster node from JMX monitoring due to exception " + e.toString());
+                    s_logger.warn("Unable to deregiester cluster node from JMX monitoring due to exception " + e.toString());
                 }
             } else {
-                logger.info("Management node " + mshost.getId() + " is detected inactive by timestamp but is pingable");
+                s_logger.info("Management node " + mshost.getId() + " is detected inactive by timestamp but is pingable");
                 it.remove();
             }
         }
@@ -906,15 +908,15 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
             if (!_activePeers.containsKey(mshost.getId())) {
                 _activePeers.put(mshost.getId(), mshost);
 
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Detected management node joined, id:" + mshost.getId() + ", nodeIP:" + mshost.getServiceIP());
+                if (s_logger.isDebugEnabled()) {
+                    s_logger.debug("Detected management node joined, id:" + mshost.getId() + ", nodeIP:" + mshost.getServiceIP());
                 }
                 newNodeList.add(mshost);
 
                 try {
                     JmxUtil.registerMBean("ClusterManager", "Node " + mshost.getId(), new ClusterManagerMBeanImpl(this, mshost));
                 } catch (final Exception e) {
-                    logger.warn("Unable to regiester cluster node into JMX monitoring due to exception " + ExceptionUtil.toString(e));
+                    s_logger.warn("Unable to regiester cluster node into JMX monitoring due to exception " + ExceptionUtil.toString(e));
                 }
             }
         }
@@ -926,8 +928,8 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
         profiler.stop();
 
         if (profiler.getDurationInMillis() >= HeartbeatInterval.value()) {
-            if (logger.isDebugEnabled()) {
-                logger.debug("Peer scan takes too long to finish. profiler: " + profiler.toString() + ", profilerQueryActiveList: " +
+            if (s_logger.isDebugEnabled()) {
+                s_logger.debug("Peer scan takes too long to finish. profiler: " + profiler.toString() + ", profilerQueryActiveList: " +
                         profilerQueryActiveList.toString() + ", profilerSyncClusterInfo: " + profilerSyncClusterInfo.toString() + ", profilerInvalidatedNodeList: " +
                         profilerInvalidatedNodeList.toString() + ", profilerRemovedList: " + profilerRemovedList.toString());
             }
@@ -946,8 +948,8 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
     @Override
     @DB
     public boolean start() {
-        if (logger.isInfoEnabled()) {
-            logger.info("Starting Cluster manager, msid : " + _msId);
+        if (s_logger.isInfoEnabled()) {
+            s_logger.info("Starting Cluster manager, msid : " + _msId);
         }
 
         final ManagementServerHostVO mshost = Transaction.execute(new TransactionCallback<ManagementServerHostVO>() {
@@ -971,14 +973,14 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                     mshost.setAlertCount(0);
                     mshost.setState(ManagementServerHost.State.Up);
                     _mshostDao.persist(mshost);
-                    if (logger.isInfoEnabled()) {
-                        logger.info("New instance of management server msid " + _msId + ", runId " + _runId + " is being started");
+                    if (s_logger.isInfoEnabled()) {
+                        s_logger.info("New instance of management server msid " + _msId + ", runId " + _runId + " is being started");
                     }
                 } else {
                     _mshostDao.update(mshost.getId(), _runId, NetUtils.getHostName(), version, _clusterNodeIP, _currentServiceAdapter.getServicePort(),
                             DateUtil.currentGMTTime());
-                    if (logger.isInfoEnabled()) {
-                        logger.info("Management server " + _msId + ", runId " + _runId + " is being started");
+                    if (s_logger.isInfoEnabled()) {
+                        s_logger.info("Management server " + _msId + ", runId " + _runId + " is being started");
                     }
                 }
 
@@ -987,8 +989,8 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
         });
 
         _mshostId = mshost.getId();
-        if (logger.isInfoEnabled()) {
-            logger.info("Management server (host id : " + _mshostId + ") is being started at " + _clusterNodeIP + ":" + _currentServiceAdapter.getServicePort());
+        if (s_logger.isInfoEnabled()) {
+            s_logger.info("Management server (host id : " + _mshostId + ") is being started at " + _clusterNodeIP + ":" + _currentServiceAdapter.getServicePort());
         }
 
         _mshostPeerDao.clearPeerInfo(_mshostId);
@@ -997,8 +999,8 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
         _heartbeatScheduler.scheduleAtFixedRate(getHeartbeatTask(), HeartbeatInterval.value(), HeartbeatInterval.value(), TimeUnit.MILLISECONDS);
         _notificationExecutor.submit(getNotificationTask());
 
-        if (logger.isInfoEnabled()) {
-            logger.info("Cluster manager was started successfully");
+        if (s_logger.isInfoEnabled()) {
+            s_logger.info("Cluster manager was started successfully");
         }
 
         return true;
@@ -1007,8 +1009,8 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
     @Override
     @DB
     public boolean stop() {
-        if (logger.isInfoEnabled()) {
-            logger.info("Stopping Cluster manager, msid : " + _msId);
+        if (s_logger.isInfoEnabled()) {
+            s_logger.info("Stopping Cluster manager, msid : " + _msId);
         }
 
         if (_mshostId != null) {
@@ -1026,8 +1028,8 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
         } catch (final InterruptedException e) {
         }
 
-        if (logger.isInfoEnabled()) {
-            logger.info("Cluster manager is stopped");
+        if (s_logger.isInfoEnabled()) {
+            s_logger.info("Cluster manager is stopped");
         }
 
         return true;
@@ -1035,8 +1037,8 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
 
     @Override
     public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
-        if (logger.isInfoEnabled()) {
-            logger.info("Start configuring cluster manager : " + name);
+        if (s_logger.isInfoEnabled()) {
+            s_logger.info("Start configuring cluster manager : " + name);
         }
 
         final Properties dbProps = DbProperties.getDbProperties();
@@ -1046,8 +1048,8 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
         }
         _clusterNodeIP = _clusterNodeIP.trim();
 
-        if (logger.isInfoEnabled()) {
-            logger.info("Cluster node IP : " + _clusterNodeIP);
+        if (s_logger.isInfoEnabled()) {
+            s_logger.info("Cluster node IP : " + _clusterNodeIP);
         }
 
         if (!NetUtils.isLocalAddress(_clusterNodeIP)) {
@@ -1072,8 +1074,8 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
 
         checkConflicts();
 
-        if (logger.isInfoEnabled()) {
-            logger.info("Cluster manager is configured.");
+        if (s_logger.isInfoEnabled()) {
+            s_logger.info("Cluster manager is configured.");
         }
         return true;
     }
@@ -1131,7 +1133,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
 
         final String targetIp = mshost.getServiceIP();
         if ("127.0.0.1".equals(targetIp) || "0.0.0.0".equals(targetIp)) {
-            logger.info("ping management node cluster service can not be performed on self");
+            s_logger.info("ping management node cluster service can not be performed on self");
             return false;
         }
 
@@ -1139,7 +1141,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
         while (--retry > 0) {
             SocketChannel sch = null;
             try {
-                logger.info("Trying to connect to " + targetIp);
+                s_logger.info("Trying to connect to " + targetIp);
                 sch = SocketChannel.open();
                 sch.configureBlocking(true);
                 sch.socket().setSoTimeout(5000);
@@ -1149,7 +1151,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                 return true;
             } catch (final IOException e) {
                 if (e instanceof ConnectException) {
-                    logger.error("Unable to ping management server at " + targetIp + ":" + mshost.getServicePort() + " due to ConnectException", e);
+                    s_logger.error("Unable to ping management server at " + targetIp + ":" + mshost.getServicePort() + " due to ConnectException", e);
                     return false;
                 }
             } finally {
@@ -1167,7 +1169,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
             }
         }
 
-        logger.error("Unable to ping management server at " + targetIp + ":" + mshost.getServicePort() + " after retries");
+        s_logger.error("Unable to ping management server at " + targetIp + ":" + mshost.getServicePort() + " after retries");
         return false;
     }
 
@@ -1184,25 +1186,25 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                 if ("127.0.0.1".equals(_clusterNodeIP)) {
                     if (pingManagementNode(peer.getMsid())) {
                         final String msg = "Detected another management node with localhost IP is already running, please check your cluster configuration";
-                        logger.error(msg);
+                        s_logger.error(msg);
                         throw new ConfigurationException(msg);
                     } else {
                         final String msg =
                                 "Detected another management node with localhost IP is considered as running in DB, however it is not pingable, we will continue cluster initialization with this management server node";
-                        logger.info(msg);
+                        s_logger.info(msg);
                     }
                 } else {
                     if (pingManagementNode(peer.getMsid())) {
                         final String msg =
                                 "Detected that another management node with the same IP " + peer.getServiceIP() +
                                 " is already running, please check your cluster configuration";
-                        logger.error(msg);
+                        s_logger.error(msg);
                         throw new ConfigurationException(msg);
                     } else {
                         final String msg =
                                 "Detected that another management node with the same IP " + peer.getServiceIP() +
                                 " is considered as running in DB, however it is not pingable, we will continue cluster initialization with this management server node";
-                        logger.info(msg);
+                        s_logger.info(msg);
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/framework/cluster/src/com/cloud/cluster/ClusterServiceServletAdapter.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/ClusterServiceServletAdapter.java b/framework/cluster/src/com/cloud/cluster/ClusterServiceServletAdapter.java
index 937ef4a..7451b5f 100644
--- a/framework/cluster/src/com/cloud/cluster/ClusterServiceServletAdapter.java
+++ b/framework/cluster/src/com/cloud/cluster/ClusterServiceServletAdapter.java
@@ -23,6 +23,7 @@ import java.util.Properties;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import org.apache.log4j.Logger;
 import org.apache.cloudstack.framework.config.ConfigDepot;
 
 import com.cloud.cluster.dao.ManagementServerHostDao;
@@ -33,6 +34,7 @@ import com.cloud.utils.db.DbProperties;
 
 public class ClusterServiceServletAdapter extends AdapterBase implements ClusterServiceAdapter {
 
+    private static final Logger s_logger = Logger.getLogger(ClusterServiceServletAdapter.class);
     private static final int DEFAULT_SERVICE_PORT = 9090;
     private static final int DEFAULT_REQUEST_TIMEOUT = 300;            // 300 seconds
 
@@ -57,7 +59,7 @@ public class ClusterServiceServletAdapter extends AdapterBase implements Cluster
         try {
             init();
         } catch (ConfigurationException e) {
-            logger.error("Unable to init ClusterServiceServletAdapter");
+            s_logger.error("Unable to init ClusterServiceServletAdapter");
             throw new RemoteException("Unable to init ClusterServiceServletAdapter");
         }
 
@@ -73,7 +75,7 @@ public class ClusterServiceServletAdapter extends AdapterBase implements Cluster
         try {
             init();
         } catch (ConfigurationException e) {
-            logger.error("Unable to init ClusterServiceServletAdapter");
+            s_logger.error("Unable to init ClusterServiceServletAdapter");
             return null;
         }
 
@@ -124,7 +126,7 @@ public class ClusterServiceServletAdapter extends AdapterBase implements Cluster
         Properties dbProps = DbProperties.getDbProperties();
 
         _clusterServicePort = NumbersUtil.parseInt(dbProps.getProperty("cluster.servlet.port"), DEFAULT_SERVICE_PORT);
-        if (logger.isInfoEnabled())
-            logger.info("Cluster servlet port : " + _clusterServicePort);
+        if (s_logger.isInfoEnabled())
+            s_logger.info("Cluster servlet port : " + _clusterServicePort);
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java b/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
index 3fe94c2..ce4667e 100644
--- a/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
+++ b/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
@@ -26,6 +26,7 @@ import java.util.TimeZone;
 
 import javax.ejb.Local;
 
+import org.apache.log4j.Logger;
 
 import com.cloud.cluster.ClusterInvalidSessionException;
 import com.cloud.cluster.ManagementServerHost;
@@ -42,6 +43,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
 
 @Local(value = {ManagementServerHostDao.class})
 public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServerHostVO, Long> implements ManagementServerHostDao {
+    private static final Logger s_logger = Logger.getLogger(ManagementServerHostDaoImpl.class);
 
     private final SearchBuilder<ManagementServerHostVO> MsIdSearch;
     private final SearchBuilder<ManagementServerHostVO> ActiveSearch;
@@ -98,7 +100,7 @@ public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServer
             pstmt.executeUpdate();
             txn.commit();
         } catch (Exception e) {
-            logger.warn("Unexpected exception, ", e);
+            s_logger.warn("Unexpected exception, ", e);
             throw new RuntimeException(e.getMessage(), e);
         }
     }
@@ -118,7 +120,7 @@ public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServer
             txn.commit();
             return true;
         } catch (Exception e) {
-            logger.warn("Unexpected exception, ", e);
+            s_logger.warn("Unexpected exception, ", e);
             throw new RuntimeException(e.getMessage(), e);
         }
     }
@@ -140,11 +142,11 @@ public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServer
             txn.commit();
 
             if (count < 1) {
-                logger.info("Invalid cluster session detected, runId " + runid + " is no longer valid");
+                s_logger.info("Invalid cluster session detected, runId " + runid + " is no longer valid");
                 throw new CloudRuntimeException("Invalid cluster session detected, runId " + runid + " is no longer valid", new ClusterInvalidSessionException("runId " + runid + " is no longer valid"));
             }
         } catch (Exception e) {
-            logger.warn("Unexpected exception, ", e);
+            s_logger.warn("Unexpected exception, ", e);
             throw new RuntimeException(e.getMessage(), e);
         }
     }
@@ -180,7 +182,7 @@ public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServer
             changedRows = pstmt.executeUpdate();
             txn.commit();
         } catch (Exception e) {
-            logger.warn("Unexpected exception, ", e);
+            s_logger.warn("Unexpected exception, ", e);
             throw new RuntimeException(e.getMessage(), e);
         }
 
@@ -221,7 +223,7 @@ public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServer
             int count = pstmt.executeUpdate();
 
             if (count < 1) {
-                logger.info("Invalid cluster session detected, runId " + runId + " is no longer valid");
+                s_logger.info("Invalid cluster session detected, runId " + runId + " is no longer valid");
                 throw new CloudRuntimeException("Invalid cluster session detected, runId " + runId + " is no longer valid", new ClusterInvalidSessionException("runId " + runId + " is no longer valid"));
             }
         } catch (SQLException e) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostPeerDaoImpl.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostPeerDaoImpl.java b/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostPeerDaoImpl.java
index 3d90703..c0c6334 100644
--- a/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostPeerDaoImpl.java
+++ b/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostPeerDaoImpl.java
@@ -20,6 +20,7 @@ import java.util.List;
 
 import javax.ejb.Local;
 
+import org.apache.log4j.Logger;
 
 import com.cloud.cluster.ManagementServerHost;
 import com.cloud.cluster.ManagementServerHostPeerVO;
@@ -31,6 +32,7 @@ import com.cloud.utils.db.TransactionLegacy;
 
 @Local(value = {ManagementServerHostPeerDao.class})
 public class ManagementServerHostPeerDaoImpl extends GenericDaoBase<ManagementServerHostPeerVO, Long> implements ManagementServerHostPeerDao {
+    private static final Logger s_logger = Logger.getLogger(ManagementServerHostPeerDaoImpl.class);
 
     private final SearchBuilder<ManagementServerHostPeerVO> ClearPeerSearch;
     private final SearchBuilder<ManagementServerHostPeerVO> FindForUpdateSearch;
@@ -85,7 +87,7 @@ public class ManagementServerHostPeerDaoImpl extends GenericDaoBase<ManagementSe
             }
             txn.commit();
         } catch (Exception e) {
-            logger.warn("Unexpected exception, ", e);
+            s_logger.warn("Unexpected exception, ", e);
             txn.rollback();
         }
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDaoImpl.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDaoImpl.java b/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDaoImpl.java
index 17b0818..65bad9c 100644
--- a/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDaoImpl.java
+++ b/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDaoImpl.java
@@ -26,6 +26,7 @@ import javax.ejb.Local;
 import javax.naming.ConfigurationException;
 
 import org.apache.cloudstack.framework.config.impl.ConfigurationVO;
+import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
 import com.cloud.utils.component.ComponentLifecycle;
@@ -40,6 +41,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
 @Component
 @Local(value = {ConfigurationDao.class})
 public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String> implements ConfigurationDao {
+    private static final Logger s_logger = Logger.getLogger(ConfigurationDaoImpl.class);
     private Map<String, String> _configs = null;
     private boolean _premium;
 
@@ -146,7 +148,7 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
             stmt.executeUpdate();
             return true;
         } catch (Exception e) {
-            logger.warn("Unable to update Configuration Value", e);
+            s_logger.warn("Unable to update Configuration Value", e);
         }
         return false;
     }
@@ -163,7 +165,7 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
                 return true;
             }
         } catch (Exception e) {
-            logger.warn("Unable to update Configuration Value", e);
+            s_logger.warn("Unable to update Configuration Value", e);
         }
         return false;
     }
@@ -197,7 +199,7 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
             }
             return returnValue;
         } catch (Exception e) {
-            logger.warn("Unable to update Configuration Value", e);
+            s_logger.warn("Unable to update Configuration Value", e);
             throw new CloudRuntimeException("Unable to initialize configuration variable: " + name);
 
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/GenericDaoBase.java b/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
index 910b446..e75646a 100644
--- a/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
+++ b/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
@@ -65,6 +65,7 @@ import net.sf.ehcache.Cache;
 import net.sf.ehcache.CacheManager;
 import net.sf.ehcache.Element;
 
+import org.apache.log4j.Logger;
 
 import com.cloud.utils.DateUtil;
 import com.cloud.utils.NumbersUtil;
@@ -114,6 +115,7 @@ import com.cloud.utils.net.NetUtils;
  **/
 @DB
 public abstract class GenericDaoBase<T, ID extends Serializable> extends ComponentLifecycleBase implements GenericDao<T, ID>, ComponentMethodInterceptable {
+    private final static Logger s_logger = Logger.getLogger(GenericDaoBase.class);
 
     protected final static TimeZone s_gmtTimeZone = TimeZone.getTimeZone("GMT");
 
@@ -253,26 +255,26 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
         _searchEnhancer.setSuperclass(_entityBeanType);
         _searchEnhancer.setCallback(new UpdateBuilder(this));
 
-        if (logger.isTraceEnabled()) {
-            logger.trace("Select SQL: " + _partialSelectSql.first().toString());
-            logger.trace("Remove SQL: " + (_removeSql != null ? _removeSql.first() : "No remove sql"));
-            logger.trace("Select by Id SQL: " + _selectByIdSql);
-            logger.trace("Table References: " + _tables);
-            logger.trace("Insert SQLs:");
+        if (s_logger.isTraceEnabled()) {
+            s_logger.trace("Select SQL: " + _partialSelectSql.first().toString());
+            s_logger.trace("Remove SQL: " + (_removeSql != null ? _removeSql.first() : "No remove sql"));
+            s_logger.trace("Select by Id SQL: " + _selectByIdSql);
+            s_logger.trace("Table References: " + _tables);
+            s_logger.trace("Insert SQLs:");
             for (final Pair<String, Attribute[]> insertSql : _insertSqls) {
-                logger.trace(insertSql.first());
+                s_logger.trace(insertSql.first());
             }
 
-            logger.trace("Delete SQLs");
+            s_logger.trace("Delete SQLs");
             for (final Pair<String, Attribute[]> deletSql : _deleteSqls) {
-                logger.trace(deletSql.first());
+                s_logger.trace(deletSql.first());
             }
 
-            logger.trace("Collection SQLs");
+            s_logger.trace("Collection SQLs");
             for (Attribute attr : _ecAttributes) {
                 EcInfo info = (EcInfo)attr.attache;
-                logger.trace(info.insertSql);
-                logger.trace(info.selectSql);
+                s_logger.trace(info.insertSql);
+                s_logger.trace(info.selectSql);
             }
         }
 
@@ -411,7 +413,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
                 }
             }
 
-            if (logger.isDebugEnabled() && lock != null) {
+            if (s_logger.isDebugEnabled() && lock != null) {
                 txn.registerLock(pstmt.toString());
             }
             final ResultSet rs = pstmt.executeQuery();
@@ -776,8 +778,8 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
             }
         }
 
-        if (logger.isTraceEnabled()) {
-            logger.trace("join search statement is " + pstmt);
+        if (s_logger.isTraceEnabled()) {
+            s_logger.trace("join search statement is " + pstmt);
         }
         return count;
     }
@@ -1595,7 +1597,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
             try {
                 _cache.put(new Element(_idField.get(entity), entity));
             } catch (final Exception e) {
-                logger.debug("Can't put it in the cache", e);
+                s_logger.debug("Can't put it in the cache", e);
             }
         }
 
@@ -1617,7 +1619,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
             try {
                 _cache.put(new Element(_idField.get(entity), entity));
             } catch (final Exception e) {
-                logger.debug("Can't put it in the cache", e);
+                s_logger.debug("Can't put it in the cache", e);
             }
         }
 
@@ -1796,7 +1798,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
             final int idle = NumbersUtil.parseInt((String)params.get("cache.time.to.idle"), 300);
             _cache = new Cache(getName(), maxElements, false, live == -1, live == -1 ? Integer.MAX_VALUE : live, idle);
             cm.addCache(_cache);
-            logger.info("Cache created: " + _cache.toString());
+            s_logger.info("Cache created: " + _cache.toString());
         } else {
             _cache = null;
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
index 22556e8..26288d5 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
@@ -21,6 +21,7 @@ import java.sql.SQLException;
 import java.util.Date;
 import java.util.List;
 
+import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.framework.jobs.impl.AsyncJobVO;
 import org.apache.cloudstack.jobs.JobInfo;
@@ -34,6 +35,7 @@ import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.TransactionLegacy;
 
 public class AsyncJobDaoImpl extends GenericDaoBase<AsyncJobVO, Long> implements AsyncJobDao {
+    private static final Logger s_logger = Logger.getLogger(AsyncJobDaoImpl.class.getName());
 
     private final SearchBuilder<AsyncJobVO> pendingAsyncJobSearch;
     private final SearchBuilder<AsyncJobVO> pendingAsyncJobsSearch;
@@ -103,7 +105,7 @@ public class AsyncJobDaoImpl extends GenericDaoBase<AsyncJobVO, Long> implements
         List<AsyncJobVO> l = listIncludingRemovedBy(sc);
         if (l != null && l.size() > 0) {
             if (l.size() > 1) {
-                logger.warn("Instance " + instanceType + "-" + instanceId + " has multiple pending async-job");
+                s_logger.warn("Instance " + instanceType + "-" + instanceId + " has multiple pending async-job");
             }
 
             return l.get(0);
@@ -190,9 +192,9 @@ public class AsyncJobDaoImpl extends GenericDaoBase<AsyncJobVO, Long> implements
             pstmt.setLong(6, msid);
             pstmt.execute();
         } catch (SQLException e) {
-            logger.warn("Unable to reset job status for management server " + msid, e);
+            s_logger.warn("Unable to reset job status for management server " + msid, e);
         } catch (Throwable e) {
-            logger.warn("Unable to reset job status for management server " + msid, e);
+            s_logger.warn("Unable to reset job status for management server " + msid, e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobJoinMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobJoinMapDaoImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobJoinMapDaoImpl.java
index da7ba36..d70864c 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobJoinMapDaoImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobJoinMapDaoImpl.java
@@ -24,6 +24,7 @@ import java.util.Date;
 import java.util.List;
 import java.util.TimeZone;
 
+import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.framework.jobs.impl.AsyncJobJoinMapVO;
 import org.apache.cloudstack.jobs.JobInfo;
@@ -38,6 +39,7 @@ import com.cloud.utils.db.UpdateBuilder;
 import com.cloud.utils.exception.CloudRuntimeException;
 
 public class AsyncJobJoinMapDaoImpl extends GenericDaoBase<AsyncJobJoinMapVO, Long> implements AsyncJobJoinMapDao {
+    public static final Logger s_logger = Logger.getLogger(AsyncJobJoinMapDaoImpl.class);
 
     private final SearchBuilder<AsyncJobJoinMapVO> RecordSearch;
     private final SearchBuilder<AsyncJobJoinMapVO> RecordSearchByOwner;
@@ -200,7 +202,7 @@ public class AsyncJobJoinMapDaoImpl extends GenericDaoBase<AsyncJobJoinMapVO, Lo
 //
 //            txn.commit();
 //        } catch (SQLException e) {
-//            logger.error("Unexpected exception", e);
+//            s_logger.error("Unexpected exception", e);
 //        }
 //
 //        return standaloneList;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/SyncQueueDaoImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/SyncQueueDaoImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/SyncQueueDaoImpl.java
index 18a9160..00bd08d 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/SyncQueueDaoImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/SyncQueueDaoImpl.java
@@ -22,6 +22,7 @@ import java.sql.SQLException;
 import java.util.Date;
 import java.util.TimeZone;
 
+import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.framework.jobs.impl.SyncQueueVO;
 
@@ -32,6 +33,7 @@ import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.TransactionLegacy;
 
 public class SyncQueueDaoImpl extends GenericDaoBase<SyncQueueVO, Long> implements SyncQueueDao {
+    private static final Logger s_logger = Logger.getLogger(SyncQueueDaoImpl.class.getName());
 
     SearchBuilder<SyncQueueVO> TypeIdSearch = createSearchBuilder();
 
@@ -58,9 +60,9 @@ public class SyncQueueDaoImpl extends GenericDaoBase<SyncQueueVO, Long> implemen
             pstmt.setString(4, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), dt));
             pstmt.execute();
         } catch (SQLException e) {
-            logger.warn("Unable to create sync queue " + syncObjType + "-" + syncObjId + ":" + e.getMessage(), e);
+            s_logger.warn("Unable to create sync queue " + syncObjType + "-" + syncObjId + ":" + e.getMessage(), e);
         } catch (Throwable e) {
-            logger.warn("Unable to create sync queue " + syncObjType + "-" + syncObjId + ":" + e.getMessage(), e);
+            s_logger.warn("Unable to create sync queue " + syncObjType + "-" + syncObjId + ":" + e.getMessage(), e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/SyncQueueItemDaoImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/SyncQueueItemDaoImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/SyncQueueItemDaoImpl.java
index 756cbb7..29c3f1b 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/SyncQueueItemDaoImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/SyncQueueItemDaoImpl.java
@@ -25,6 +25,7 @@ import java.util.Date;
 import java.util.List;
 import java.util.TimeZone;
 
+import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.framework.jobs.impl.SyncQueueItemVO;
 
@@ -41,6 +42,7 @@ import com.cloud.utils.db.TransactionLegacy;
 
 @DB
 public class SyncQueueItemDaoImpl extends GenericDaoBase<SyncQueueItemVO, Long> implements SyncQueueItemDao {
+    private static final Logger s_logger = Logger.getLogger(SyncQueueItemDaoImpl.class);
     final GenericSearchBuilder<SyncQueueItemVO, Long> queueIdSearch;
     final GenericSearchBuilder<SyncQueueItemVO, Integer> queueActiveItemSearch;
 
@@ -114,9 +116,9 @@ public class SyncQueueItemDaoImpl extends GenericDaoBase<SyncQueueItemVO, Long>
                 l.add(item);
             }
         } catch (SQLException e) {
-            logger.error("Unexpected sql exception, ", e);
+            s_logger.error("Unexpected sql exception, ", e);
         } catch (Throwable e) {
-            logger.error("Unexpected exception, ", e);
+            s_logger.error("Unexpected exception, ", e);
         }
         return l;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/VmWorkJobDaoImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/VmWorkJobDaoImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/VmWorkJobDaoImpl.java
index ecefac2..e81ab1e 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/VmWorkJobDaoImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/VmWorkJobDaoImpl.java
@@ -24,6 +24,7 @@ import java.util.List;
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 
+import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.framework.jobs.impl.VmWorkJobVO;
 import org.apache.cloudstack.framework.jobs.impl.VmWorkJobVO.Step;
@@ -42,6 +43,7 @@ import com.cloud.utils.db.TransactionStatus;
 import com.cloud.vm.VirtualMachine;
 
 public class VmWorkJobDaoImpl extends GenericDaoBase<VmWorkJobVO, Long> implements VmWorkJobDao {
+    private static final Logger s_logger = Logger.getLogger(VmWorkJobDaoImpl.class);
 
     protected SearchBuilder<VmWorkJobVO> PendingWorkJobSearch;
     protected SearchBuilder<VmWorkJobVO> PendingWorkJobByCommandSearch;
@@ -143,8 +145,8 @@ public class VmWorkJobDaoImpl extends GenericDaoBase<VmWorkJobVO, Long> implemen
         sc.setParameters("dispatcher", "VmWorkJobDispatcher");
         List<VmWorkJobVO> expungeList = listBy(sc);
         for (VmWorkJobVO job : expungeList) {
-            if (logger.isDebugEnabled())
-                logger.debug("Expunge completed work job-" + job.getId());
+            if (s_logger.isDebugEnabled())
+                s_logger.debug("Expunge completed work job-" + job.getId());
             expunge(job.getId());
             _baseJobDao.expunge(job.getId());
         }
@@ -174,10 +176,10 @@ public class VmWorkJobDaoImpl extends GenericDaoBase<VmWorkJobVO, Long> implemen
 
                     pstmt.execute();
                 } catch (SQLException e) {
-                    logger.info("[ignored]"
+                    s_logger.info("[ignored]"
                             + "SQL failed to delete vm work job: " + e.getLocalizedMessage());
                 } catch (Throwable e) {
-                    logger.info("[ignored]"
+                    s_logger.info("[ignored]"
                             + "caught an error during delete vm work job: " + e.getLocalizedMessage());
                 }
 
@@ -189,10 +191,10 @@ public class VmWorkJobDaoImpl extends GenericDaoBase<VmWorkJobVO, Long> implemen
 
                     pstmt.execute();
                 } catch (SQLException e) {
-                    logger.info("[ignored]"
+                    s_logger.info("[ignored]"
                             + "SQL failed to delete async job: " + e.getLocalizedMessage());
                 } catch (Throwable e) {
-                    logger.info("[ignored]"
+                    s_logger.info("[ignored]"
                             + "caught an error during delete async job: " + e.getLocalizedMessage());
                 }
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
index cd48c77..1ea3c78 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
@@ -33,6 +33,7 @@ import java.util.concurrent.TimeUnit;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import org.apache.log4j.Logger;
 import org.apache.log4j.NDC;
 
 import org.apache.cloudstack.api.ApiErrorCode;
@@ -92,6 +93,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
             Integer.class, "vm.job.lock.timeout", "1800",
             "Time in seconds to wait in acquiring lock to submit a vm worker job", false);
 
+    private static final Logger s_logger = Logger.getLogger(AsyncJobManagerImpl.class);
 
     private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION = 3;     // 3 seconds
 
@@ -177,8 +179,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
 
         publishOnEventBus(job, "submit");
         scheduleExecution(job, scheduleJobExecutionInContext);
-        if (logger.isDebugEnabled()) {
-            logger.debug("submit async job-" + job.getId() + ", details: " + StringUtils.cleanString(job.toString()));
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("submit async job-" + job.getId() + ", details: " + StringUtils.cleanString(job.toString()));
         }
         return job.getId();
     }
@@ -214,7 +216,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
             }
         } catch (Exception e) {
             String errMsg = "Unable to schedule async job for command " + job.getCmd() + ", unexpected exception.";
-            logger.warn(errMsg, e);
+            s_logger.warn(errMsg, e);
             throw new CloudRuntimeException(errMsg);
         }
     }
@@ -222,14 +224,14 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
     @Override
     @DB
     public void completeAsyncJob(final long jobId, final Status jobStatus, final int resultCode, final String resultObject) {
-        if (logger.isDebugEnabled()) {
-            logger.debug("Complete async job-" + jobId + ", jobStatus: " + jobStatus + ", resultCode: " + resultCode + ", result: " + resultObject);
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Complete async job-" + jobId + ", jobStatus: " + jobStatus + ", resultCode: " + resultCode + ", result: " + resultObject);
         }
 
         final AsyncJobVO job = _jobDao.findById(jobId);
         if (job == null) {
-            if (logger.isDebugEnabled()) {
-                logger.debug("job-" + jobId + " no longer exists, we just log completion info here. " + jobStatus + ", resultCode: " + resultCode + ", result: " +
+            if (s_logger.isDebugEnabled()) {
+                s_logger.debug("job-" + jobId + " no longer exists, we just log completion info here. " + jobStatus + ", resultCode: " + resultCode + ", result: " +
                     resultObject);
             }
             // still purge item from queue to avoid any blocking
@@ -238,8 +240,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
         }
 
         if (job.getStatus() != JobInfo.Status.IN_PROGRESS) {
-            if (logger.isDebugEnabled()) {
-                logger.debug("job-" + jobId + " is already completed.");
+            if (s_logger.isDebugEnabled()) {
+                s_logger.debug("job-" + jobId + " is already completed.");
             }
             // still purge item from queue to avoid any blocking
             _queueMgr.purgeAsyncJobQueueItemId(jobId);
@@ -250,18 +252,18 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
             job.setResult(resultObject);
         }
 
-        if (logger.isDebugEnabled()) {
-            logger.debug("Publish async job-" + jobId + " complete on message bus");
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Publish async job-" + jobId + " complete on message bus");
         }
 
-        if (logger.isDebugEnabled()) {
-            logger.debug("Wake up jobs related to job-" + jobId);
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Wake up jobs related to job-" + jobId);
         }
         List<Long> wakeupList = Transaction.execute(new TransactionCallback<List<Long>>() {
             @Override
             public List<Long> doInTransaction(TransactionStatus status) {
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Update db status for job-" + jobId);
+                if (s_logger.isDebugEnabled()) {
+                    s_logger.debug("Update db status for job-" + jobId);
                 }
                 job.setCompleteMsid(getMsid());
                 job.setStatus(jobStatus);
@@ -277,8 +279,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                 job.setExecutingMsid(null);
                 _jobDao.update(jobId, job);
 
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Wake up jobs joined with job-" + jobId + " and disjoin all subjobs created from job- " + jobId);
+                if (s_logger.isDebugEnabled()) {
+                    s_logger.debug("Wake up jobs joined with job-" + jobId + " and disjoin all subjobs created from job- " + jobId);
                 }
                 List<Long> wakeupList = wakeupByJoinedJobCompletion(jobId);
                 _joinMapDao.disjoinAllJobs(jobId);
@@ -309,14 +311,14 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
     @Override
     @DB
     public void updateAsyncJobStatus(final long jobId, final int processStatus, final String resultObject) {
-        if (logger.isDebugEnabled()) {
-            logger.debug("Update async-job progress, job-" + jobId + ", processStatus: " + processStatus + ", result: " + resultObject);
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Update async-job progress, job-" + jobId + ", processStatus: " + processStatus + ", result: " + resultObject);
         }
 
         final AsyncJobVO job = _jobDao.findById(jobId);
         if (job == null) {
-            if (logger.isDebugEnabled()) {
-                logger.debug("job-" + jobId + " no longer exists, we just log progress info here. progress status: " + processStatus);
+            if (s_logger.isDebugEnabled()) {
+                s_logger.debug("job-" + jobId + " no longer exists, we just log progress info here. progress status: " + processStatus);
             }
 
             return;
@@ -339,8 +341,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
     @Override
     @DB
     public void updateAsyncJobAttachment(final long jobId, final String instanceType, final Long instanceId) {
-        if (logger.isDebugEnabled()) {
-            logger.debug("Update async-job attachment, job-" + jobId + ", instanceType: " + instanceType + ", instanceId: " + instanceId);
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Update async-job attachment, job-" + jobId + ", instanceType: " + instanceType + ", instanceId: " + instanceId);
         }
 
         final AsyncJobVO job = _jobDao.findById(jobId);
@@ -405,8 +407,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
 
     @Override
     public void syncAsyncJobExecution(AsyncJob job, String syncObjType, long syncObjId, long queueSizeLimit) {
-        if (logger.isDebugEnabled()) {
-            logger.debug("Sync job-" + job.getId() + " execution on object " + syncObjType + "." + syncObjId);
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Sync job-" + job.getId() + " execution on object " + syncObjType + "." + syncObjId);
         }
 
         SyncQueueVO queue = null;
@@ -463,7 +465,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                         return dispatcher;
                 }
             } else {
-                logger.warn("job-" + job.getId() + " is scheduled for wakeup run, but there is no joining info anymore");
+                s_logger.warn("job-" + job.getId() + " is scheduled for wakeup run, but there is no joining info anymore");
             }
         }
         return null;
@@ -508,16 +510,16 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                     } catch (Exception e) {
                         // Due to co-existence of normal-dispatched-job/wakeup-dispatched-job, MBean register() call
                         // is expected to fail under situations
-                        if (logger.isTraceEnabled())
-                            logger.trace("Unable to register active job " + job.getId() + " to JMX monitoring due to exception " + ExceptionUtil.toString(e));
+                        if (s_logger.isTraceEnabled())
+                            s_logger.trace("Unable to register active job " + job.getId() + " to JMX monitoring due to exception " + ExceptionUtil.toString(e));
                     }
 
                     _jobMonitor.registerActiveTask(runNumber, job.getId());
                     AsyncJobExecutionContext.setCurrentExecutionContext(new AsyncJobExecutionContext(job));
 
                     // execute the job
-                    if (logger.isDebugEnabled()) {
-                        logger.debug("Executing " + StringUtils.cleanString(job.toString()));
+                    if (s_logger.isDebugEnabled()) {
+                        s_logger.debug("Executing " + StringUtils.cleanString(job.toString()));
                     }
 
                     if ((getAndResetPendingSignals(job) & AsyncJob.Constants.SIGNAL_MASK_WAKEUP) != 0) {
@@ -526,25 +528,25 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                             jobDispatcher.runJob(job);
                         } else {
                             // TODO, job wakeup is not in use yet
-                            if (logger.isTraceEnabled())
-                                logger.trace("Unable to find a wakeup dispatcher from the joined job: " + job);
+                            if (s_logger.isTraceEnabled())
+                                s_logger.trace("Unable to find a wakeup dispatcher from the joined job: " + job);
                         }
                     } else {
                         AsyncJobDispatcher jobDispatcher = getDispatcher(job.getDispatcher());
                         if (jobDispatcher != null) {
                             jobDispatcher.runJob(job);
                         } else {
-                            logger.error("Unable to find job dispatcher, job will be cancelled");
+                            s_logger.error("Unable to find job dispatcher, job will be cancelled");
                             completeAsyncJob(job.getId(), JobInfo.Status.FAILED, ApiErrorCode.INTERNAL_ERROR.getHttpCode(), null);
                         }
                     }
 
-                    if (logger.isDebugEnabled()) {
-                        logger.debug("Done executing " + job.getCmd() + " for job-" + job.getId());
+                    if (s_logger.isDebugEnabled()) {
+                        s_logger.debug("Done executing " + job.getCmd() + " for job-" + job.getId());
                     }
 
                 } catch (Throwable e) {
-                    logger.error("Unexpected exception", e);
+                    s_logger.error("Unexpected exception", e);
                     completeAsyncJob(job.getId(), JobInfo.Status.FAILED, ApiErrorCode.INTERNAL_ERROR.getHttpCode(), null);
                 } finally {
                     // guard final clause as well
@@ -559,8 +561,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                         } catch (Exception e) {
                             // Due to co-existence of normal-dispatched-job/wakeup-dispatched-job, MBean unregister() call
                             // is expected to fail under situations
-                            if (logger.isTraceEnabled())
-                                logger.trace("Unable to unregister job " + job.getId() + " to JMX monitoring due to exception " + ExceptionUtil.toString(e));
+                            if (s_logger.isTraceEnabled())
+                                s_logger.trace("Unable to unregister job " + job.getId() + " to JMX monitoring due to exception " + ExceptionUtil.toString(e));
                         }
 
                         //
@@ -570,7 +572,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                         _jobMonitor.unregisterActiveTask(runNumber);
 
                     } catch (Throwable e) {
-                        logger.error("Double exception", e);
+                        s_logger.error("Double exception", e);
                     }
                 }
             }
@@ -590,8 +592,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
     private void executeQueueItem(SyncQueueItemVO item, boolean fromPreviousSession) {
         AsyncJobVO job = _jobDao.findById(item.getContentId());
         if (job != null) {
-            if (logger.isDebugEnabled()) {
-                logger.debug("Schedule queued job-" + job.getId());
+            if (s_logger.isDebugEnabled()) {
+                s_logger.debug("Schedule queued job-" + job.getId());
             }
 
             job.setSyncSource(item);
@@ -605,37 +607,37 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                 job.setExecutingMsid(getMsid());
                 _jobDao.update(job.getId(), job);
             } catch (Exception e) {
-                logger.warn("Unexpected exception while dispatching job-" + item.getContentId(), e);
+                s_logger.warn("Unexpected exception while dispatching job-" + item.getContentId(), e);
 
                 try {
                     _queueMgr.returnItem(item.getId());
                 } catch (Throwable thr) {
-                    logger.error("Unexpected exception while returning job-" + item.getContentId() + " to queue", thr);
+                    s_logger.error("Unexpected exception while returning job-" + item.getContentId() + " to queue", thr);
                 }
             }
 
             try {
                 scheduleExecution(job);
             } catch (RejectedExecutionException e) {
-                logger.warn("Execution for job-" + job.getId() + " is rejected, return it to the queue for next turn");
+                s_logger.warn("Execution for job-" + job.getId() + " is rejected, return it to the queue for next turn");
 
                 try {
                     _queueMgr.returnItem(item.getId());
                 } catch (Exception e2) {
-                    logger.error("Unexpected exception while returning job-" + item.getContentId() + " to queue", e2);
+                    s_logger.error("Unexpected exception while returning job-" + item.getContentId() + " to queue", e2);
                 }
 
                 try {
                     job.setExecutingMsid(null);
                     _jobDao.update(job.getId(), job);
                 } catch (Exception e3) {
-                    logger.warn("Unexpected exception while update job-" + item.getContentId() + " msid for bookkeeping");
+                    s_logger.warn("Unexpected exception while update job-" + item.getContentId() + " msid for bookkeeping");
                 }
             }
 
         } else {
-            if (logger.isDebugEnabled()) {
-                logger.debug("Unable to find related job for queue item: " + item.toString());
+            if (s_logger.isDebugEnabled()) {
+                s_logger.debug("Unable to find related job for queue item: " + item.toString());
             }
 
             _queueMgr.purgeItem(item.getId());
@@ -648,8 +650,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
         assert (executionContext != null);
 
         if (executionContext.getSyncSource() != null) {
-            if (logger.isDebugEnabled()) {
-                logger.debug("Release sync source for job-" + executionContext.getJob().getId() + " sync source: " + executionContext.getSyncSource().getContentType() +
+            if (s_logger.isDebugEnabled()) {
+                s_logger.debug("Release sync source for job-" + executionContext.getJob().getId() + " sync source: " + executionContext.getSyncSource().getContentType() +
                     "-" + executionContext.getSyncSource().getContentId());
             }
 
@@ -706,8 +708,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
             try {
                 SyncQueueItemVO item = _queueMgr.dequeueFromOne(queueId, getMsid());
                 if (item != null) {
-                    if (logger.isDebugEnabled()) {
-                        logger.debug("Executing sync queue item: " + item.toString());
+                    if (s_logger.isDebugEnabled()) {
+                        s_logger.debug("Executing sync queue item: " + item.toString());
                     }
 
                     executeQueueItem(item, false);
@@ -715,7 +717,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                     break;
                 }
             } catch (Throwable e) {
-                logger.error("Unexpected exception when kicking sync queue-" + queueId, e);
+                s_logger.error("Unexpected exception when kicking sync queue-" + queueId, e);
                 break;
             }
         }
@@ -745,8 +747,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                     List<SyncQueueItemVO> l = _queueMgr.dequeueFromAny(getMsid(), MAX_ONETIME_SCHEDULE_SIZE);
                     if (l != null && l.size() > 0) {
                         for (SyncQueueItemVO item : l) {
-                            if (logger.isDebugEnabled()) {
-                                logger.debug("Execute sync-queue item: " + item.toString());
+                            if (s_logger.isDebugEnabled()) {
+                                s_logger.debug("Execute sync-queue item: " + item.toString());
                             }
                             executeQueueItem(item, false);
                         }
@@ -760,7 +762,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                             scheduleExecution(job, false);
                     }
                 } catch (Throwable e) {
-                    logger.error("Unexpected exception when trying to execute queue item, ", e);
+                    s_logger.error("Unexpected exception when trying to execute queue item, ", e);
                 }
             }
         };
@@ -787,7 +789,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
 
             public void reallyRun() {
                 try {
-                    logger.info("Begin cleanup expired async-jobs");
+                    s_logger.info("Begin cleanup expired async-jobs");
 
                     // forcefully cancel blocking queue items if they've been staying there for too long
                     List<SyncQueueItemVO> blockItems = _queueMgr.getBlockedQueueItems(JobCancelThresholdMinutes.value() * 60000, false);
@@ -795,7 +797,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                         for (SyncQueueItemVO item : blockItems) {
                             try {
                                 if (item.getContentType().equalsIgnoreCase(SyncQueueItem.AsyncJobContentType)) {
-                                    logger.info("Remove Job-" + item.getContentId() + " from Queue-" + item.getId() + " since it has been blocked for too long");
+                                    s_logger.info("Remove Job-" + item.getContentId() + " from Queue-" + item.getId() + " since it has been blocked for too long");
                                     completeAsyncJob(item.getContentId(), JobInfo.Status.FAILED, 0, "Job is cancelled as it has been blocking others for too long");
 
                                     _jobMonitor.unregisterByJobId(item.getContentId());
@@ -804,7 +806,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                                 // purge the item and resume queue processing
                                 _queueMgr.purgeItem(item.getId());
                             } catch (Throwable e) {
-                                logger.error("Unexpected exception when trying to remove job from sync queue, ", e);
+                                s_logger.error("Unexpected exception when trying to remove job from sync queue, ", e);
                             }
                         }
                     }
@@ -816,12 +818,12 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                     List<AsyncJobVO> unfinishedJobs = _jobDao.getExpiredUnfinishedJobs(cutTime, 100);
                     for (AsyncJobVO job : unfinishedJobs) {
                         try {
-                            logger.info("Expunging unfinished job-" + job.getId());
+                            s_logger.info("Expunging unfinished job-" + job.getId());
 
                             _jobMonitor.unregisterByJobId(job.getId());
                             expungeAsyncJob(job);
                         } catch (Throwable e) {
-                            logger.error("Unexpected exception when trying to expunge job-" + job.getId(), e);
+                            s_logger.error("Unexpected exception when trying to expunge job-" + job.getId(), e);
                         }
                     }
 
@@ -829,17 +831,17 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                     List<AsyncJobVO> completedJobs = _jobDao.getExpiredCompletedJobs(cutTime, 100);
                     for (AsyncJobVO job : completedJobs) {
                         try {
-                            logger.info("Expunging completed job-" + job.getId());
+                            s_logger.info("Expunging completed job-" + job.getId());
 
                             expungeAsyncJob(job);
                         } catch (Throwable e) {
-                            logger.error("Unexpected exception when trying to expunge job-" + job.getId(), e);
+                            s_logger.error("Unexpected exception when trying to expunge job-" + job.getId(), e);
                         }
                     }
 
-                    logger.info("End cleanup expired async-jobs");
+                    s_logger.info("End cleanup expired async-jobs");
                 } catch (Throwable e) {
-                    logger.error("Unexpected exception when trying to execute queue item, ", e);
+                    s_logger.error("Unexpected exception when trying to execute queue item, ", e);
                 }
             }
         };
@@ -931,10 +933,10 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
             int apiPoolSize = cloudMaxActive / 2;
             int workPoolSize = (cloudMaxActive * 2) / 3;
 
-            logger.info("Start AsyncJobManager API executor thread pool in size " + apiPoolSize);
+            s_logger.info("Start AsyncJobManager API executor thread pool in size " + apiPoolSize);
             _apiJobExecutor = Executors.newFixedThreadPool(apiPoolSize, new NamedThreadFactory(AsyncJobManager.API_JOB_POOL_THREAD_PREFIX));
 
-            logger.info("Start AsyncJobManager Work executor thread pool in size " + workPoolSize);
+            s_logger.info("Start AsyncJobManager Work executor thread pool in size " + workPoolSize);
             _workerJobExecutor = Executors.newFixedThreadPool(workPoolSize, new NamedThreadFactory(AsyncJobManager.WORK_JOB_POOL_THREAD_PREFIX));
         } catch (final Exception e) {
             throw new ConfigurationException("Unable to load db.properties to configure AsyncJobManagerImpl");
@@ -981,22 +983,22 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                     // reset job status for all jobs running on this ms node
                     List<AsyncJobVO> jobs = _jobDao.getResetJobs(msid);
                     for (AsyncJobVO job : jobs) {
-                        if (logger.isDebugEnabled()) {
-                            logger.debug("Cancel left-over job-" + job.getId());
+                        if (s_logger.isDebugEnabled()) {
+                            s_logger.debug("Cancel left-over job-" + job.getId());
                         }
                         job.setStatus(JobInfo.Status.FAILED);
                         job.setResultCode(ApiErrorCode.INTERNAL_ERROR.getHttpCode());
                         job.setResult("job cancelled because of management server restart or shutdown");
                         _jobDao.update(job.getId(), job);
-                        if (logger.isDebugEnabled()) {
-                            logger.debug("Purge queue item for cancelled job-" + job.getId());
+                        if (s_logger.isDebugEnabled()) {
+                            s_logger.debug("Purge queue item for cancelled job-" + job.getId());
                         }
                         _queueMgr.purgeAsyncJobQueueItemId(job.getId());
                     }
                 }
             });
         } catch (Throwable e) {
-            logger.warn("Unexpected exception in cleaning up left over jobs for mamagement server node " + msid, e);
+            s_logger.warn("Unexpected exception in cleaning up left over jobs for mamagement server node " + msid, e);
         }
     }
 


Mime
View raw message