http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobMonitor.java ---------------------------------------------------------------------- diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobMonitor.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobMonitor.java index b1cac3e..b2216cb 100644 --- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobMonitor.java +++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobMonitor.java @@ -25,7 +25,6 @@ import java.util.concurrent.atomic.AtomicInteger; import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; import org.apache.cloudstack.framework.jobs.AsyncJob; import org.apache.cloudstack.framework.jobs.AsyncJobManager; @@ -37,7 +36,6 @@ import org.apache.cloudstack.managed.context.ManagedContextTimerTask; import com.cloud.utils.component.ManagerBase; public class AsyncJobMonitor extends ManagerBase { - public static final Logger s_logger = Logger.getLogger(AsyncJobMonitor.class); @Inject private MessageBus _messageBus; @@ -86,7 +84,7 @@ public class AsyncJobMonitor extends ManagerBase { synchronized (this) { for (Map.Entry<Long, ActiveTaskRecord> entry : _activeTasks.entrySet()) { if (entry.getValue().millisSinceLastJobHeartbeat() > _inactivityWarningThresholdMs) { - s_logger.warn("Task (job-" + entry.getValue().getJobId() + ") has been pending for " + logger.warn("Task (job-" + entry.getValue().getJobId() + ") has been pending for " + entry.getValue().millisSinceLastJobHeartbeat() / 1000 + " seconds"); } } @@ -110,7 +108,7 @@ public class AsyncJobMonitor extends ManagerBase { public void registerActiveTask(long runNumber, long jobId) { synchronized (this) { - s_logger.info("Add job-" + jobId + " into job monitoring"); + logger.info("Add job-" + jobId + " into job monitoring"); assert (_activeTasks.get(runNumber) == null); @@ -130,7 +128,7 @@ public class AsyncJobMonitor extends ManagerBase { ActiveTaskRecord record = _activeTasks.get(runNumber); assert (record != null); if (record != null) { - s_logger.info("Remove job-" + record.getJobId() + " from job monitoring"); + logger.info("Remove job-" + record.getJobId() + " from job monitoring"); if (record.isPoolThread()) _activePoolThreads.decrementAndGet(); @@ -148,7 +146,7 @@ public class AsyncJobMonitor extends ManagerBase { while (it.hasNext()) { Map.Entry<Long, ActiveTaskRecord> entry = it.next(); if (entry.getValue().getJobId() == jobId) { - s_logger.info("Remove Job-" + entry.getValue().getJobId() + " from job monitoring due to job cancelling"); + logger.info("Remove Job-" + entry.getValue().getJobId() + " from job monitoring due to job cancelling"); if (entry.getValue().isPoolThread()) _activePoolThreads.decrementAndGet();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/SyncQueueManagerImpl.java ---------------------------------------------------------------------- diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/SyncQueueManagerImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/SyncQueueManagerImpl.java index 2f97991..3397daa 100644 --- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/SyncQueueManagerImpl.java +++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/SyncQueueManagerImpl.java @@ -22,7 +22,6 @@ import java.util.List; import javax.inject.Inject; -import org.apache.log4j.Logger; import org.apache.cloudstack.framework.jobs.dao.SyncQueueDao; import org.apache.cloudstack.framework.jobs.dao.SyncQueueItemDao; @@ -36,7 +35,6 @@ import com.cloud.utils.db.TransactionStatus; import com.cloud.utils.exception.CloudRuntimeException; public class SyncQueueManagerImpl extends ManagerBase implements SyncQueueManager { - public static final Logger s_logger = Logger.getLogger(SyncQueueManagerImpl.class.getName()); @Inject private SyncQueueDao _syncQueueDao; @@ -70,7 +68,7 @@ public class SyncQueueManagerImpl extends ManagerBase implements SyncQueueManage } }); } catch (Exception e) { - s_logger.error("Unexpected exception: ", e); + logger.error("Unexpected exception: ", e); } return null; } @@ -84,7 +82,7 @@ public class SyncQueueManagerImpl extends ManagerBase implements SyncQueueManage public SyncQueueItemVO doInTransaction(TransactionStatus status) { SyncQueueVO queueVO = _syncQueueDao.findById(queueId); if(queueVO == null) { - s_logger.error("Sync queue(id: " + queueId + ") does not exist"); + logger.error("Sync queue(id: " + queueId + ") does not exist"); return null; } @@ -109,19 +107,19 @@ public class SyncQueueManagerImpl extends ManagerBase implements SyncQueueManage return itemVO; } else { - if (s_logger.isDebugEnabled()) - s_logger.debug("Sync queue (" + queueId + ") is currently empty"); + if (logger.isDebugEnabled()) + logger.debug("Sync queue (" + queueId + ") is currently empty"); } } else { - if (s_logger.isDebugEnabled()) - s_logger.debug("There is a pending process in sync queue(id: " + queueId + ")"); + if (logger.isDebugEnabled()) + logger.debug("There is a pending process in sync queue(id: " + queueId + ")"); } return null; } }); } catch (Exception e) { - s_logger.error("Unexpected exception: ", e); + logger.error("Unexpected exception: ", e); } return null; @@ -169,7 +167,7 @@ public class SyncQueueManagerImpl extends ManagerBase implements SyncQueueManage return resultList; } catch (Exception e) { - s_logger.error("Unexpected exception: ", e); + logger.error("Unexpected exception: ", e); } return null; @@ -200,14 +198,14 @@ public class SyncQueueManagerImpl extends ManagerBase implements SyncQueueManage } }); } catch (Exception e) { - s_logger.error("Unexpected exception: ", e); + logger.error("Unexpected exception: ", e); } } @Override @DB public void returnItem(final long queueItemId) { - s_logger.info("Returning queue item " + queueItemId + " back to queue for second try in case of DB deadlock"); + logger.info("Returning queue item " + queueItemId + " back to queue for second try in case of DB deadlock"); try { Transaction.execute(new TransactionCallbackNoReturn() { @Override @@ -228,7 +226,7 @@ public class SyncQueueManagerImpl extends ManagerBase implements SyncQueueManage } }); } catch (Exception e) { - s_logger.error("Unexpected exception: ", e); + logger.error("Unexpected exception: ", e); } } @@ -247,8 +245,8 @@ public class SyncQueueManagerImpl extends ManagerBase implements SyncQueueManage if (nActiveItems < queueVO.getQueueSizeLimit()) return true; - if (s_logger.isDebugEnabled()) - s_logger.debug("Queue (queue id, sync type, sync id) - (" + queueVO.getId() + if (logger.isDebugEnabled()) + logger.debug("Queue (queue id, sync type, sync id) - (" + queueVO.getId() + "," + queueVO.getSyncObjType() + ", " + queueVO.getSyncObjId() + ") is reaching concurrency limit " + queueVO.getQueueSizeLimit()); return false; @@ -266,8 +264,8 @@ public class SyncQueueManagerImpl extends ManagerBase implements SyncQueueManage public void cleanupActiveQueueItems(Long msid, boolean exclusive) { List<SyncQueueItemVO> l = getActiveQueueItems(msid, false); for (SyncQueueItemVO item : l) { - if (s_logger.isInfoEnabled()) { - s_logger.info("Discard left-over queue item: " + item.toString()); + if (logger.isInfoEnabled()) { + logger.info("Discard left-over queue item: " + item.toString()); } purgeItem(item.getId()); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/framework/jobs/test/org/apache/cloudstack/framework/jobs/AsyncJobTestDispatcher.java ---------------------------------------------------------------------- diff --git a/framework/jobs/test/org/apache/cloudstack/framework/jobs/AsyncJobTestDispatcher.java b/framework/jobs/test/org/apache/cloudstack/framework/jobs/AsyncJobTestDispatcher.java index eb30a80..604eae7 100644 --- a/framework/jobs/test/org/apache/cloudstack/framework/jobs/AsyncJobTestDispatcher.java +++ b/framework/jobs/test/org/apache/cloudstack/framework/jobs/AsyncJobTestDispatcher.java @@ -20,15 +20,12 @@ import java.util.Random; import javax.inject.Inject; -import org.apache.log4j.Logger; import org.apache.cloudstack.jobs.JobInfo.Status; import com.cloud.utils.component.AdapterBase; public class AsyncJobTestDispatcher extends AdapterBase implements AsyncJobDispatcher { - private static final Logger s_logger = - Logger.getLogger(AsyncJobTestDispatcher.class); @Inject private AsyncJobManager _asyncJobMgr; @@ -45,14 +42,14 @@ public class AsyncJobTestDispatcher extends AdapterBase implements AsyncJobDispa public void runJob(final AsyncJob job) { _testDashboard.increaseConcurrency(); - s_logger.info("Execute job " + job.getId() + ", current concurrency " + _testDashboard.getConcurrencyCount()); + logger.info("Execute job " + job.getId() + ", current concurrency " + _testDashboard.getConcurrencyCount()); int interval = 3000; try { Thread.sleep(interval); } catch (InterruptedException e) { - s_logger.debug("[ignored] ."); + logger.debug("[ignored] ."); } _asyncJobMgr.completeAsyncJob(job.getId(), Status.SUCCEEDED, 0, null); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/framework/security/src/org/apache/cloudstack/framework/security/keystore/KeystoreManagerImpl.java ---------------------------------------------------------------------- diff --git a/framework/security/src/org/apache/cloudstack/framework/security/keystore/KeystoreManagerImpl.java b/framework/security/src/org/apache/cloudstack/framework/security/keystore/KeystoreManagerImpl.java index 374c080..ec1ead7 100644 --- a/framework/security/src/org/apache/cloudstack/framework/security/keystore/KeystoreManagerImpl.java +++ b/framework/security/src/org/apache/cloudstack/framework/security/keystore/KeystoreManagerImpl.java @@ -32,7 +32,6 @@ import javax.ejb.Local; import javax.inject.Inject; import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import com.cloud.utils.Ternary; @@ -43,7 +42,6 @@ import com.cloud.utils.security.CertificateHelper; @Component @Local(value = KeystoreManager.class) public class KeystoreManagerImpl extends ManagerBase implements KeystoreManager { - private static final Logger s_logger = Logger.getLogger(KeystoreManagerImpl.class); @Inject private KeystoreDao _ksDao; @@ -51,7 +49,7 @@ public class KeystoreManagerImpl extends ManagerBase implements KeystoreManager @Override public boolean validateCertificate(String certificate, String key, String domainSuffix) { if (certificate == null || certificate.isEmpty() || key == null || key.isEmpty() || domainSuffix == null || domainSuffix.isEmpty()) { - s_logger.error("Invalid parameter found in (certificate, key, domainSuffix) tuple for domain: " + domainSuffix); + logger.error("Invalid parameter found in (certificate, key, domainSuffix) tuple for domain: " + domainSuffix); return false; } @@ -62,9 +60,9 @@ public class KeystoreManagerImpl extends ManagerBase implements KeystoreManager if (ks != null) return true; - s_logger.error("Unabled to construct keystore for domain: " + domainSuffix); + logger.error("Unabled to construct keystore for domain: " + domainSuffix); } catch (Exception e) { - s_logger.error("Certificate validation failed due to exception for domain: " + domainSuffix, e); + logger.error("Certificate validation failed due to exception for domain: " + domainSuffix, e); } return false; } @@ -110,15 +108,15 @@ public class KeystoreManagerImpl extends ManagerBase implements KeystoreManager try { return CertificateHelper.buildAndSaveKeystore(certs, storePassword); } catch (KeyStoreException e) { - s_logger.warn("Unable to build keystore for " + name + " due to KeyStoreException"); + logger.warn("Unable to build keystore for " + name + " due to KeyStoreException"); } catch (CertificateException e) { - s_logger.warn("Unable to build keystore for " + name + " due to CertificateException"); + logger.warn("Unable to build keystore for " + name + " due to CertificateException"); } catch (NoSuchAlgorithmException e) { - s_logger.warn("Unable to build keystore for " + name + " due to NoSuchAlgorithmException"); + logger.warn("Unable to build keystore for " + name + " due to NoSuchAlgorithmException"); } catch (InvalidKeySpecException e) { - s_logger.warn("Unable to build keystore for " + name + " due to InvalidKeySpecException"); + logger.warn("Unable to build keystore for " + name + " due to InvalidKeySpecException"); } catch (IOException e) { - s_logger.warn("Unable to build keystore for " + name + " due to IOException"); + logger.warn("Unable to build keystore for " + name + " due to IOException"); } return null; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/framework/spring/lifecycle/src/main/java/org/apache/cloudstack/spring/lifecycle/registry/DumpRegistry.java ---------------------------------------------------------------------- diff --git a/framework/spring/lifecycle/src/main/java/org/apache/cloudstack/spring/lifecycle/registry/DumpRegistry.java b/framework/spring/lifecycle/src/main/java/org/apache/cloudstack/spring/lifecycle/registry/DumpRegistry.java index 79e35f1..100431c 100644 --- a/framework/spring/lifecycle/src/main/java/org/apache/cloudstack/spring/lifecycle/registry/DumpRegistry.java +++ b/framework/spring/lifecycle/src/main/java/org/apache/cloudstack/spring/lifecycle/registry/DumpRegistry.java @@ -22,17 +22,12 @@ import java.util.List; import javax.inject.Inject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import com.cloud.utils.component.ComponentLifecycleBase; import com.cloud.utils.component.Named; import com.cloud.utils.component.Registry; public class DumpRegistry extends ComponentLifecycleBase { - private static final Logger log = LoggerFactory.getLogger(DumpRegistry.class); - List<Registry<?>> registries; public List<Registry<?>> getRegistries() { @@ -55,10 +50,8 @@ public class DumpRegistry extends ComponentLifecycleBase { buffer.append(getName(o)); } - - log.info("Registry [{}] contains [{}]", registry.getName(), buffer); + logger.info(String.format("Registry [%s] contains [%s]", registry.getName(), buffer)); } - return super.start(); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java ---------------------------------------------------------------------- diff --git a/plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java b/plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java index 4383b45..edc51b6 100644 --- a/plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java +++ b/plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java @@ -26,7 +26,6 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; import org.apache.cloudstack.api.APICommand; @@ -43,7 +42,6 @@ import com.cloud.utils.component.PluggableService; @Local(value = APIChecker.class) public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIChecker { - protected static final Logger s_logger = Logger.getLogger(StaticRoleBasedAPIAccessChecker.class); Set<String> commandPropertyFiles = new HashSet<String>(); Set<String> commandsPropertiesOverrides = new HashSet<String>(); @@ -118,7 +116,7 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIC commandsPropertiesRoleBasedApisMap.get(roleType).add(apiName); } } catch (NumberFormatException nfe) { - s_logger.info("Malformed key=value pair for entry: " + entry.toString()); + logger.info("Malformed key=value pair for entry: " + entry.toString()); } } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/plugins/affinity-group-processors/explicit-dedication/src/org/apache/cloudstack/affinity/ExplicitDedicationProcessor.java ---------------------------------------------------------------------- diff --git a/plugins/affinity-group-processors/explicit-dedication/src/org/apache/cloudstack/affinity/ExplicitDedicationProcessor.java b/plugins/affinity-group-processors/explicit-dedication/src/org/apache/cloudstack/affinity/ExplicitDedicationProcessor.java index 9aad5f4..8eef201 100644 --- a/plugins/affinity-group-processors/explicit-dedication/src/org/apache/cloudstack/affinity/ExplicitDedicationProcessor.java +++ b/plugins/affinity-group-processors/explicit-dedication/src/org/apache/cloudstack/affinity/ExplicitDedicationProcessor.java @@ -25,7 +25,6 @@ import javax.inject.Inject; import org.apache.cloudstack.affinity.dao.AffinityGroupDao; import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao; -import org.apache.log4j.Logger; import com.cloud.dc.ClusterVO; import com.cloud.dc.DataCenter; @@ -58,7 +57,6 @@ import com.cloud.vm.dao.VMInstanceDao; @Local(value = AffinityGroupProcessor.class) public class ExplicitDedicationProcessor extends AffinityProcessorBase implements AffinityGroupProcessor { - private static final Logger s_logger = Logger.getLogger(ExplicitDedicationProcessor.class); @Inject protected UserVmDao _vmDao; @Inject @@ -98,8 +96,8 @@ public class ExplicitDedicationProcessor extends AffinityProcessorBase implement for (AffinityGroupVMMapVO vmGroupMapping : vmGroupMappings) { if (vmGroupMapping != null) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Processing affinity group " + vmGroupMapping.getAffinityGroupId() + "of type 'ExplicitDedication' for VM Id: " + vm.getId()); + if (logger.isDebugEnabled()) { + logger.debug("Processing affinity group " + vmGroupMapping.getAffinityGroupId() + "of type 'ExplicitDedication' for VM Id: " + vm.getId()); } long affinityGroupId = vmGroupMapping.getAffinityGroupId(); @@ -236,13 +234,13 @@ public class ExplicitDedicationProcessor extends AffinityProcessorBase implement avoid = updateAvoidList(resourceList, avoid, dc); } else { avoid.addDataCenter(dc.getId()); - if (s_logger.isDebugEnabled()) { - s_logger.debug("No dedicated resources available for this domain or account under this group"); + if (logger.isDebugEnabled()) { + logger.debug("No dedicated resources available for this domain or account under this group"); } } - if (s_logger.isDebugEnabled()) { - s_logger.debug("ExplicitDedicationProcessor returns Avoid List as: Deploy avoids pods: " + avoid.getPodsToAvoid() + ", clusters: " + + if (logger.isDebugEnabled()) { + logger.debug("ExplicitDedicationProcessor returns Avoid List as: Deploy avoids pods: " + avoid.getPodsToAvoid() + ", clusters: " + avoid.getClustersToAvoid() + ", hosts: " + avoid.getHostsToAvoid()); } } @@ -409,8 +407,8 @@ public class ExplicitDedicationProcessor extends AffinityProcessorBase implement if (group != null) { List<DedicatedResourceVO> dedicatedResources = _dedicatedDao.listByAffinityGroupId(group.getId()); if (!dedicatedResources.isEmpty()) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Releasing the dedicated resources under group: " + group); + if (logger.isDebugEnabled()) { + logger.debug("Releasing the dedicated resources under group: " + group); } Transaction.execute(new TransactionCallbackNoReturn() { @@ -427,8 +425,8 @@ public class ExplicitDedicationProcessor extends AffinityProcessorBase implement } }); } else { - if (s_logger.isDebugEnabled()) { - s_logger.debug("No dedicated resources to releease under group: " + group); + if (logger.isDebugEnabled()) { + logger.debug("No dedicated resources to releease under group: " + group); } } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java ---------------------------------------------------------------------- diff --git a/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java b/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java index 0504dc6..35039fd 100644 --- a/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java +++ b/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java @@ -23,7 +23,6 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; import org.apache.cloudstack.affinity.dao.AffinityGroupDao; import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao; @@ -47,7 +46,6 @@ import com.cloud.vm.dao.VMInstanceDao; @Local(value = AffinityGroupProcessor.class) public class HostAntiAffinityProcessor extends AffinityProcessorBase implements AffinityGroupProcessor { - private static final Logger s_logger = Logger.getLogger(HostAntiAffinityProcessor.class); @Inject protected UserVmDao _vmDao; @Inject @@ -72,8 +70,8 @@ public class HostAntiAffinityProcessor extends AffinityProcessorBase implements if (vmGroupMapping != null) { AffinityGroupVO group = _affinityGroupDao.findById(vmGroupMapping.getAffinityGroupId()); - if (s_logger.isDebugEnabled()) { - s_logger.debug("Processing affinity group " + group.getName() + " for VM Id: " + vm.getId()); + if (logger.isDebugEnabled()) { + logger.debug("Processing affinity group " + group.getName() + " for VM Id: " + vm.getId()); } List<Long> groupVMIds = _affinityGroupVMMapDao.listVmIdsByAffinityGroup(group.getId()); @@ -84,15 +82,15 @@ public class HostAntiAffinityProcessor extends AffinityProcessorBase implements if (groupVM != null && !groupVM.isRemoved()) { if (groupVM.getHostId() != null) { avoid.addHost(groupVM.getHostId()); - if (s_logger.isDebugEnabled()) { - s_logger.debug("Added host " + groupVM.getHostId() + " to avoid set, since VM " + groupVM.getId() + " is present on the host"); + if (logger.isDebugEnabled()) { + logger.debug("Added host " + groupVM.getHostId() + " to avoid set, since VM " + groupVM.getId() + " is present on the host"); } } else if (VirtualMachine.State.Stopped.equals(groupVM.getState()) && groupVM.getLastHostId() != null) { long secondsSinceLastUpdate = (DateUtil.currentGMTTime().getTime() - groupVM.getUpdateTime().getTime()) / 1000; if (secondsSinceLastUpdate < _vmCapacityReleaseInterval) { avoid.addHost(groupVM.getLastHostId()); - if (s_logger.isDebugEnabled()) { - s_logger.debug("Added host " + groupVM.getLastHostId() + " to avoid set, since VM " + groupVM.getId() + + if (logger.isDebugEnabled()) { + logger.debug("Added host " + groupVM.getLastHostId() + " to avoid set, since VM " + groupVM.getId() + " is present on the host, in Stopped state but has reserved capacity"); } } @@ -132,8 +130,8 @@ public class HostAntiAffinityProcessor extends AffinityProcessorBase implements for (Long groupVMId : groupVMIds) { VMReservationVO vmReservation = _reservationDao.findByVmId(groupVMId); if (vmReservation != null && vmReservation.getHostId() != null && vmReservation.getHostId().equals(plannedHostId)) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Planned destination for VM " + vm.getId() + " conflicts with an existing VM " + vmReservation.getVmId() + + if (logger.isDebugEnabled()) { + logger.debug("Planned destination for VM " + vm.getId() + " conflicts with an existing VM " + vmReservation.getVmId() + " reserved on the same host " + plannedHostId); } return false; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java ---------------------------------------------------------------------- diff --git a/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java index cb691a9..5c6682a 100644 --- a/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java +++ b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java @@ -27,7 +27,6 @@ import java.util.Set; import javax.ejb.Local; import javax.inject.Inject; -import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import com.google.gson.annotations.SerializedName; @@ -55,7 +54,6 @@ import com.cloud.utils.component.PluggableService; @Component @Local(value = ApiDiscoveryService.class) public class ApiDiscoveryServiceImpl extends ComponentLifecycleBase implements ApiDiscoveryService { - private static final Logger s_logger = Logger.getLogger(ApiDiscoveryServiceImpl.class); List<APIChecker> _apiAccessCheckers = null; List<PluggableService> _services = null; @@ -72,13 +70,13 @@ public class ApiDiscoveryServiceImpl extends ComponentLifecycleBase implements A s_apiNameDiscoveryResponseMap = new HashMap<String, ApiDiscoveryResponse>(); Set<Class<?>> cmdClasses = new HashSet<Class<?>>(); for (PluggableService service : _services) { - s_logger.debug(String.format("getting api commands of service: %s", service.getClass().getName())); + logger.debug(String.format("getting api commands of service: %s", service.getClass().getName())); cmdClasses.addAll(service.getCommands()); } cmdClasses.addAll(this.getCommands()); cacheResponseMap(cmdClasses); long endTime = System.nanoTime(); - s_logger.info("Api Discovery Service: Annotation, docstrings, api relation graph processed in " + (endTime - startTime) / 1000000.0 + " ms"); + logger.info("Api Discovery Service: Annotation, docstrings, api relation graph processed in " + (endTime - startTime) / 1000000.0 + " ms"); } return true; @@ -97,8 +95,8 @@ public class ApiDiscoveryServiceImpl extends ComponentLifecycleBase implements A } String apiName = apiCmdAnnotation.name(); - if (s_logger.isTraceEnabled()) { - s_logger.trace("Found api: " + apiName); + if (logger.isTraceEnabled()) { + logger.trace("Found api: " + apiName); } ApiDiscoveryResponse response = getCmdRequestMap(cmdClass, apiCmdAnnotation); @@ -227,7 +225,7 @@ public class ApiDiscoveryServiceImpl extends ComponentLifecycleBase implements A try { apiChecker.checkAccess(user, name); } catch (Exception ex) { - s_logger.debug("API discovery access check failed for " + name + " with " + ex.getMessage()); + logger.debug("API discovery access check failed for " + name + " with " + ex.getMessage()); return null; } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/ApiRateLimitServiceImpl.java ---------------------------------------------------------------------- diff --git a/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/ApiRateLimitServiceImpl.java b/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/ApiRateLimitServiceImpl.java index b46dc15..55b3b28 100644 --- a/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/ApiRateLimitServiceImpl.java +++ b/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/ApiRateLimitServiceImpl.java @@ -27,7 +27,6 @@ import javax.naming.ConfigurationException; import net.sf.ehcache.Cache; import net.sf.ehcache.CacheManager; -import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import org.apache.cloudstack.acl.APIChecker; @@ -47,7 +46,6 @@ import com.cloud.utils.component.AdapterBase; @Component @Local(value = APIChecker.class) public class ApiRateLimitServiceImpl extends AdapterBase implements APIChecker, ApiRateLimitService { - private static final Logger s_logger = Logger.getLogger(ApiRateLimitServiceImpl.class); /** * True if api rate limiting is enabled @@ -100,7 +98,7 @@ public class ApiRateLimitServiceImpl extends AdapterBase implements APIChecker, CacheManager cm = CacheManager.create(); Cache cache = new Cache("api-limit-cache", maxElements, false, false, timeToLive, timeToLive); cm.addCache(cache); - s_logger.info("Limit Cache created with timeToLive=" + timeToLive + ", maxAllowed=" + maxAllowed + ", maxElements=" + maxElements); + logger.info("Limit Cache created with timeToLive=" + timeToLive + ", maxAllowed=" + maxAllowed + ", maxElements=" + maxElements); cacheStore.setCache(cache); _store = cacheStore; @@ -165,13 +163,13 @@ public class ApiRateLimitServiceImpl extends AdapterBase implements APIChecker, int current = entry.incrementAndGet(); if (current <= maxAllowed) { - s_logger.trace("account (" + account.getAccountId() + "," + account.getAccountName() + ") has current count = " + current); + logger.trace("account (" + account.getAccountId() + "," + account.getAccountName() + ") has current count = " + current); return true; } else { long expireAfter = entry.getExpireDuration(); // for this exception, we can just show the same message to user and admin users. String msg = "The given user has reached his/her account api limit, please retry after " + expireAfter + " ms."; - s_logger.warn(msg); + logger.warn(msg); throw new RequestLimitException(msg); } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java ---------------------------------------------------------------------- diff --git a/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java b/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java index 9500cac..6970965 100644 --- a/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java +++ b/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java @@ -26,7 +26,6 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; import com.cloud.configuration.Config; import com.cloud.exception.InsufficientServerCapacityException; @@ -44,7 +43,6 @@ import com.cloud.vm.VirtualMachineProfile; @Local(value = DeploymentPlanner.class) public class ImplicitDedicationPlanner extends FirstFitPlanner implements DeploymentClusterPlanner { - private static final Logger s_logger = Logger.getLogger(ImplicitDedicationPlanner.class); @Inject private ServiceOfferingDao serviceOfferingDao; @@ -159,12 +157,12 @@ public class ImplicitDedicationPlanner extends FirstFitPlanner implements Deploy for (VMInstanceVO vm : allVmsOnHost) { if (vm.getAccountId() != accountId) { - s_logger.info("Host " + vm.getHostId() + " found to be unsuitable for implicit dedication as it is " + "running instances of another account"); + logger.info("Host " + vm.getHostId() + " found to be unsuitable for implicit dedication as it is " + "running instances of another account"); suitable = false; break; } else { if (!isImplicitPlannerUsedByOffering(vm.getServiceOfferingId())) { - s_logger.info("Host " + vm.getHostId() + " found to be unsuitable for implicit dedication as it " + + logger.info("Host " + vm.getHostId() + " found to be unsuitable for implicit dedication as it " + "is running instances of this account which haven't been created using implicit dedication."); suitable = false; break; @@ -180,11 +178,11 @@ public class ImplicitDedicationPlanner extends FirstFitPlanner implements Deploy return false; for (VMInstanceVO vm : allVmsOnHost) { if (!isImplicitPlannerUsedByOffering(vm.getServiceOfferingId())) { - s_logger.info("Host " + vm.getHostId() + " found to be running a vm created by a planner other" + " than implicit."); + logger.info("Host " + vm.getHostId() + " found to be running a vm created by a planner other" + " than implicit."); createdByImplicitStrict = false; break; } else if (isServiceOfferingUsingPlannerInPreferredMode(vm.getServiceOfferingId())) { - s_logger.info("Host " + vm.getHostId() + " found to be running a vm created by an implicit planner" + " in preferred mode."); + logger.info("Host " + vm.getHostId() + " found to be running a vm created by an implicit planner" + " in preferred mode."); createdByImplicitStrict = false; break; } @@ -196,7 +194,7 @@ public class ImplicitDedicationPlanner extends FirstFitPlanner implements Deploy boolean implicitPlannerUsed = false; ServiceOfferingVO offering = serviceOfferingDao.findByIdIncludingRemoved(offeringId); if (offering == null) { - s_logger.error("Couldn't retrieve the offering by the given id : " + offeringId); + logger.error("Couldn't retrieve the offering by the given id : " + offeringId); } else { String plannerName = offering.getDeploymentPlanner(); if (plannerName == null) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/plugins/deployment-planners/user-concentrated-pod/src/com/cloud/deploy/UserConcentratedPodPlanner.java ---------------------------------------------------------------------- diff --git a/plugins/deployment-planners/user-concentrated-pod/src/com/cloud/deploy/UserConcentratedPodPlanner.java b/plugins/deployment-planners/user-concentrated-pod/src/com/cloud/deploy/UserConcentratedPodPlanner.java index df6531e..6c74715 100644 --- a/plugins/deployment-planners/user-concentrated-pod/src/com/cloud/deploy/UserConcentratedPodPlanner.java +++ b/plugins/deployment-planners/user-concentrated-pod/src/com/cloud/deploy/UserConcentratedPodPlanner.java @@ -22,7 +22,6 @@ import java.util.Map; import javax.ejb.Local; -import org.apache.log4j.Logger; import com.cloud.utils.Pair; import com.cloud.vm.VirtualMachineProfile; @@ -30,7 +29,6 @@ import com.cloud.vm.VirtualMachineProfile; @Local(value = DeploymentPlanner.class) public class UserConcentratedPodPlanner extends FirstFitPlanner implements DeploymentClusterPlanner { - private static final Logger s_logger = Logger.getLogger(UserConcentratedPodPlanner.class); /** * This method should reorder the given list of Cluster Ids by applying any necessary heuristic @@ -64,14 +62,14 @@ public class UserConcentratedPodPlanner extends FirstFitPlanner implements Deplo private List<Long> reorderClustersByPods(List<Long> clusterIds, List<Long> podIds) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Reordering cluster list as per pods ordered by user concentration"); + if (logger.isDebugEnabled()) { + logger.debug("Reordering cluster list as per pods ordered by user concentration"); } Map<Long, List<Long>> podClusterMap = _clusterDao.getPodClusterIdMap(clusterIds); - if (s_logger.isTraceEnabled()) { - s_logger.trace("Pod To cluster Map is: " + podClusterMap); + if (logger.isTraceEnabled()) { + logger.trace("Pod To cluster Map is: " + podClusterMap); } List<Long> reorderedClusters = new ArrayList<Long>(); @@ -90,22 +88,22 @@ public class UserConcentratedPodPlanner extends FirstFitPlanner implements Deplo } reorderedClusters.addAll(clusterIds); - if (s_logger.isTraceEnabled()) { - s_logger.trace("Reordered cluster list: " + reorderedClusters); + if (logger.isTraceEnabled()) { + logger.trace("Reordered cluster list: " + reorderedClusters); } return reorderedClusters; } protected List<Long> listPodsByUserConcentration(long zoneId, long accountId) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Applying UserConcentratedPod heuristic for account: " + accountId); + if (logger.isDebugEnabled()) { + logger.debug("Applying UserConcentratedPod heuristic for account: " + accountId); } List<Long> prioritizedPods = _vmDao.listPodIdsHavingVmsforAccount(zoneId, accountId); - if (s_logger.isTraceEnabled()) { - s_logger.trace("List of pods to be considered, after applying UserConcentratedPod heuristic: " + prioritizedPods); + if (logger.isTraceEnabled()) { + logger.trace("List of pods to be considered, after applying UserConcentratedPod heuristic: " + prioritizedPods); } return prioritizedPods; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/plugins/deployment-planners/user-dispersing/src/com/cloud/deploy/UserDispersingPlanner.java ---------------------------------------------------------------------- diff --git a/plugins/deployment-planners/user-dispersing/src/com/cloud/deploy/UserDispersingPlanner.java b/plugins/deployment-planners/user-dispersing/src/com/cloud/deploy/UserDispersingPlanner.java index 5df4d13..2b1e7c7 100644 --- a/plugins/deployment-planners/user-dispersing/src/com/cloud/deploy/UserDispersingPlanner.java +++ b/plugins/deployment-planners/user-dispersing/src/com/cloud/deploy/UserDispersingPlanner.java @@ -26,7 +26,6 @@ import java.util.TreeMap; import javax.ejb.Local; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; import com.cloud.configuration.Config; import com.cloud.utils.NumbersUtil; @@ -36,7 +35,6 @@ import com.cloud.vm.VirtualMachineProfile; @Local(value = DeploymentPlanner.class) public class UserDispersingPlanner extends FirstFitPlanner implements DeploymentClusterPlanner { - private static final Logger s_logger = Logger.getLogger(UserDispersingPlanner.class); /** * This method should reorder the given list of Cluster Ids by applying any necessary heuristic @@ -99,8 +97,8 @@ public class UserDispersingPlanner extends FirstFitPlanner implements Deployment } protected Pair<List<Long>, Map<Long, Double>> listClustersByUserDispersion(long id, boolean isZone, long accountId) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Applying Userdispersion heuristic to clusters for account: " + accountId); + if (logger.isDebugEnabled()) { + logger.debug("Applying Userdispersion heuristic to clusters for account: " + accountId); } Pair<List<Long>, Map<Long, Double>> clusterIdsVmCountInfo; if (isZone) { @@ -108,19 +106,19 @@ public class UserDispersingPlanner extends FirstFitPlanner implements Deployment } else { clusterIdsVmCountInfo = _vmInstanceDao.listClusterIdsInPodByVmCount(id, accountId); } - if (s_logger.isTraceEnabled()) { - s_logger.trace("List of clusters in ascending order of number of VMs: " + clusterIdsVmCountInfo.first()); + if (logger.isTraceEnabled()) { + logger.trace("List of clusters in ascending order of number of VMs: " + clusterIdsVmCountInfo.first()); } return clusterIdsVmCountInfo; } protected Pair<List<Long>, Map<Long, Double>> listPodsByUserDispersion(long dataCenterId, long accountId) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Applying Userdispersion heuristic to pods for account: " + accountId); + if (logger.isDebugEnabled()) { + logger.debug("Applying Userdispersion heuristic to pods for account: " + accountId); } Pair<List<Long>, Map<Long, Double>> podIdsVmCountInfo = _vmInstanceDao.listPodIdsInZoneByVmCount(dataCenterId, accountId); - if (s_logger.isTraceEnabled()) { - s_logger.trace("List of pods in ascending order of number of VMs: " + podIdsVmCountInfo.first()); + if (logger.isTraceEnabled()) { + logger.trace("List of pods in ascending order of number of VMs: " + podIdsVmCountInfo.first()); } return podIdsVmCountInfo; @@ -132,25 +130,25 @@ public class UserDispersingPlanner extends FirstFitPlanner implements Deployment Map<Long, Double> capacityMap = capacityInfo.second(); Map<Long, Double> vmCountMap = vmCountInfo.second(); - if (s_logger.isTraceEnabled()) { - s_logger.trace("Capacity Id list: " + capacityOrderedIds + " , capacityMap:" + capacityMap); + if (logger.isTraceEnabled()) { + logger.trace("Capacity Id list: " + capacityOrderedIds + " , capacityMap:" + capacityMap); } - if (s_logger.isTraceEnabled()) { - s_logger.trace("Vm Count Id list: " + vmCountOrderedIds + " , vmCountMap:" + vmCountMap); + if (logger.isTraceEnabled()) { + logger.trace("Vm Count Id list: " + vmCountOrderedIds + " , vmCountMap:" + vmCountMap); } List<Long> idsReorderedByWeights = new ArrayList<Long>(); float capacityWeight = (1.0f - _userDispersionWeight); - if (s_logger.isDebugEnabled()) { - s_logger.debug("Applying userDispersionWeight: " + _userDispersionWeight); + if (logger.isDebugEnabled()) { + logger.debug("Applying userDispersionWeight: " + _userDispersionWeight); } //normalize the vmCountMap LinkedHashMap<Long, Double> normalisedVmCountIdMap = new LinkedHashMap<Long, Double>(); Long totalVmsOfAccount = _vmInstanceDao.countRunningByAccount(accountId); - if (s_logger.isDebugEnabled()) { - s_logger.debug("Total VMs for account: " + totalVmsOfAccount); + if (logger.isDebugEnabled()) { + logger.debug("Total VMs for account: " + totalVmsOfAccount); } for (Long id : vmCountOrderedIds) { Double normalisedCount = vmCountMap.get(id) / totalVmsOfAccount; @@ -179,8 +177,8 @@ public class UserDispersingPlanner extends FirstFitPlanner implements Deployment idsReorderedByWeights.addAll(idList); } - if (s_logger.isTraceEnabled()) { - s_logger.trace("Reordered Id list: " + idsReorderedByWeights); + if (logger.isTraceEnabled()) { + logger.trace("Reordered Id list: " + idsReorderedByWeights); } return idsReorderedByWeights; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/plugins/event-bus/inmemory/src/org/apache/cloudstack/mom/inmemory/InMemoryEventBus.java ---------------------------------------------------------------------- diff --git a/plugins/event-bus/inmemory/src/org/apache/cloudstack/mom/inmemory/InMemoryEventBus.java b/plugins/event-bus/inmemory/src/org/apache/cloudstack/mom/inmemory/InMemoryEventBus.java index fd2f9f3..ebed807 100644 --- a/plugins/event-bus/inmemory/src/org/apache/cloudstack/mom/inmemory/InMemoryEventBus.java +++ b/plugins/event-bus/inmemory/src/org/apache/cloudstack/mom/inmemory/InMemoryEventBus.java @@ -26,7 +26,6 @@ import java.util.concurrent.ConcurrentHashMap; import javax.ejb.Local; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; import org.apache.cloudstack.framework.events.Event; import org.apache.cloudstack.framework.events.EventBus; @@ -40,7 +39,6 @@ import com.cloud.utils.component.ManagerBase; @Local(value = EventBus.class) public class InMemoryEventBus extends ManagerBase implements EventBus { - private static final Logger s_logger = Logger.getLogger(InMemoryEventBus.class); private final static Map<UUID, Pair<EventTopic, EventSubscriber>> subscribers; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/plugins/event-bus/kafka/src/org/apache/cloudstack/mom/kafka/KafkaEventBus.java ---------------------------------------------------------------------- diff --git a/plugins/event-bus/kafka/src/org/apache/cloudstack/mom/kafka/KafkaEventBus.java b/plugins/event-bus/kafka/src/org/apache/cloudstack/mom/kafka/KafkaEventBus.java index 6d943df..a981645 100644 --- a/plugins/event-bus/kafka/src/org/apache/cloudstack/mom/kafka/KafkaEventBus.java +++ b/plugins/event-bus/kafka/src/org/apache/cloudstack/mom/kafka/KafkaEventBus.java @@ -28,7 +28,6 @@ import java.util.Properties; import javax.ejb.Local; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; import org.apache.cloudstack.framework.events.Event; import org.apache.cloudstack.framework.events.EventBus; @@ -52,7 +51,6 @@ public class KafkaEventBus extends ManagerBase implements EventBus { private String _topic = null; private Producer<String,String> _producer; - private static final Logger s_logger = Logger.getLogger(KafkaEventBus.class); @Override public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/plugins/event-bus/rabbitmq/src/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java ---------------------------------------------------------------------- diff --git a/plugins/event-bus/rabbitmq/src/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java b/plugins/event-bus/rabbitmq/src/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java index e53d2e9..d69147b 100644 --- a/plugins/event-bus/rabbitmq/src/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java +++ b/plugins/event-bus/rabbitmq/src/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java @@ -30,7 +30,6 @@ import java.util.concurrent.Executors; import javax.ejb.Local; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; import com.rabbitmq.client.AMQP; import com.rabbitmq.client.AlreadyClosedException; @@ -93,7 +92,6 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus { private ExecutorService executorService; private static DisconnectHandler disconnectHandler; - private static final Logger s_logger = Logger.getLogger(RabbitMQEventBus.class); @Override public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { @@ -235,9 +233,9 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus { s_subscribers.put(queueName, queueDetails); } catch (AlreadyClosedException closedException) { - s_logger.warn("Connection to AMQP service is lost. Subscription:" + queueName + " will be active after reconnection"); + logger.warn("Connection to AMQP service is lost. Subscription:" + queueName + " will be active after reconnection"); } catch (ConnectException connectException) { - s_logger.warn("Connection to AMQP service is lost. Subscription:" + queueName + " will be active after reconnection"); + logger.warn("Connection to AMQP service is lost. Subscription:" + queueName + " will be active after reconnection"); } catch (Exception e) { throw new EventBusException("Failed to subscribe to event due to " + e.getMessage()); } @@ -357,7 +355,7 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus { try { return createConnection(); } catch (Exception e) { - s_logger.error("Failed to create a connection to AMQP server due to " + e.getMessage()); + logger.error("Failed to create a connection to AMQP server due to " + e.getMessage()); throw e; } } else { @@ -397,7 +395,7 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus { s_connection.close(); } } catch (Exception e) { - s_logger.warn("Failed to close connection to AMQP server due to " + e.getMessage()); + logger.warn("Failed to close connection to AMQP server due to " + e.getMessage()); } s_connection = null; } @@ -409,7 +407,7 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus { try { s_connection.abort(); } catch (Exception e) { - s_logger.warn("Failed to abort connection due to " + e.getMessage()); + logger.warn("Failed to abort connection due to " + e.getMessage()); } s_connection = null; } @@ -426,7 +424,7 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus { try { return connection.createChannel(); } catch (java.io.IOException exception) { - s_logger.warn("Failed to create a channel due to " + exception.getMessage()); + logger.warn("Failed to create a channel due to " + exception.getMessage()); throw exception; } } @@ -435,7 +433,7 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus { try { channel.exchangeDeclare(exchangeName, "topic", true); } catch (java.io.IOException exception) { - s_logger.error("Failed to create exchange" + exchangeName + " on RabbitMQ server"); + logger.error("Failed to create exchange" + exchangeName + " on RabbitMQ server"); throw exception; } } @@ -445,7 +443,7 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus { byte[] messageBodyBytes = eventDescription.getBytes(); channel.basicPublish(exchangeName, routingKey, MessageProperties.PERSISTENT_TEXT_PLAIN, messageBodyBytes); } catch (Exception e) { - s_logger.error("Failed to publish event " + routingKey + " on exchange " + exchangeName + " of message broker due to " + e.getMessage()); + logger.error("Failed to publish event " + routingKey + " on exchange " + exchangeName + " of message broker due to " + e.getMessage()); throw e; } } @@ -498,7 +496,7 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus { channel.queueDelete(queueName); channel.abort(); } catch (IOException ioe) { - s_logger.warn("Failed to delete queue: " + queueName + " on AMQP server due to " + ioe.getMessage()); + logger.warn("Failed to delete queue: " + queueName + " on AMQP server due to " + ioe.getMessage()); } } } @@ -521,7 +519,7 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus { } abortConnection(); // disconnected to AMQP server, so abort the connection and channels - s_logger.warn("Connection has been shutdown by AMQP server. Attempting to reconnect."); + logger.warn("Connection has been shutdown by AMQP server. Attempting to reconnect."); // initiate re-connect process ReconnectionTask reconnect = new ReconnectionTask(); @@ -599,7 +597,7 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus { s_subscribers.put(subscriberId, subscriberDetails); } } catch (Exception e) { - s_logger.warn("Failed to recreate queues and binding for the subscribers due to " + e.getMessage()); + logger.warn("Failed to recreate queues and binding for the subscribers due to " + e.getMessage()); } } return; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/plugins/file-systems/netapp/src/com/cloud/netapp/NetappManagerImpl.java ---------------------------------------------------------------------- diff --git a/plugins/file-systems/netapp/src/com/cloud/netapp/NetappManagerImpl.java b/plugins/file-systems/netapp/src/com/cloud/netapp/NetappManagerImpl.java index 510e6c6..15014af 100644 --- a/plugins/file-systems/netapp/src/com/cloud/netapp/NetappManagerImpl.java +++ b/plugins/file-systems/netapp/src/com/cloud/netapp/NetappManagerImpl.java @@ -35,7 +35,6 @@ import netapp.manage.NaElement; import netapp.manage.NaException; import netapp.manage.NaServer; -import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import com.cloud.api.commands.netapp.AssociateLunCmd; @@ -68,7 +67,6 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { roundrobin, leastfull } - public static final Logger s_logger = Logger.getLogger(NetappManagerImpl.class.getName()); @Inject public VolumeDao _volumeDao; @Inject @@ -85,8 +83,8 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { @Override public void createPool(String poolName, String algorithm) throws InvalidParameterValueException { - if (s_logger.isDebugEnabled()) - s_logger.debug("Request --> createPool "); + if (logger.isDebugEnabled()) + logger.debug("Request --> createPool "); PoolVO pool = null; validAlgorithm(algorithm); @@ -94,8 +92,8 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { pool = new PoolVO(poolName, algorithm); _poolDao.persist(pool); - if (s_logger.isDebugEnabled()) - s_logger.debug("Response --> createPool:success"); + if (logger.isDebugEnabled()) + logger.debug("Response --> createPool:success"); } catch (CloudRuntimeException cre) { pool = _poolDao.findPool(poolName); @@ -174,8 +172,8 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { @Override public void deletePool(String poolName) throws InvalidParameterValueException, ResourceInUseException { - if (s_logger.isDebugEnabled()) - s_logger.debug("Request --> deletePool "); + if (logger.isDebugEnabled()) + logger.debug("Request --> deletePool "); PoolVO pool = _poolDao.findPool(poolName); if (pool == null) { @@ -186,8 +184,8 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { if (volCount == 0) { _poolDao.remove(pool.getId()); - if (s_logger.isDebugEnabled()) - s_logger.debug("Request --> deletePool: Success "); + if (logger.isDebugEnabled()) + logger.debug("Request --> deletePool: Success "); } else { throw new ResourceInUseException("Cannot delete non-empty pool"); @@ -218,14 +216,14 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { volume = _volumeDao.findVolume(ipAddress, aggrName, volName); if (volume == null) { - s_logger.warn("The volume does not exist in our system"); + logger.warn("The volume does not exist in our system"); throw new InvalidParameterValueException("The given tuple:" + ipAddress + "," + aggrName + "," + volName + " doesn't exist in our system"); } List<LunVO> lunsOnVol = _lunDao.listLunsByVolId(volume.getId()); if (lunsOnVol != null && lunsOnVol.size() > 0) { - s_logger.warn("There are luns on the volume"); + logger.warn("There are luns on the volume"); throw new ResourceInUseException("There are luns on the volume"); } @@ -258,12 +256,12 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { txn.commit(); } catch (UnknownHostException uhe) { - s_logger.warn("Unable to delete volume on filer ", uhe); + logger.warn("Unable to delete volume on filer ", uhe); throw new ServerException("Unable to delete volume on filer", uhe); } catch (NaAPIFailedException naf) { - s_logger.warn("Unable to delete volume on filer ", naf); + logger.warn("Unable to delete volume on filer ", naf); if (naf.getErrno() == 13040) { - s_logger.info("Deleting the volume: " + volName); + logger.info("Deleting the volume: " + volName); _volumeDao.remove(volume.getId()); txn.commit(); } @@ -271,11 +269,11 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { throw new ServerException("Unable to delete volume on filer", naf); } catch (NaException nae) { txn.rollback(); - s_logger.warn("Unable to delete volume on filer ", nae); + logger.warn("Unable to delete volume on filer ", nae); throw new ServerException("Unable to delete volume on filer", nae); } catch (IOException ioe) { txn.rollback(); - s_logger.warn("Unable to delete volume on filer ", ioe); + logger.warn("Unable to delete volume on filer ", ioe); throw new ServerException("Unable to delete volume on filer", ioe); } finally { if (pool != null) { @@ -306,8 +304,8 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { public void createVolumeOnFiler(String ipAddress, String aggName, String poolName, String volName, String volSize, String snapshotPolicy, Integer snapshotReservation, String username, String password) throws UnknownHostException, ServerException, InvalidParameterValueException { - if (s_logger.isDebugEnabled()) - s_logger.debug("Request --> createVolume " + "serverIp:" + ipAddress); + if (logger.isDebugEnabled()) + logger.debug("Request --> createVolume " + "serverIp:" + ipAddress); boolean snapPolicy = false; boolean snapshotRes = false; @@ -394,7 +392,7 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { } pool = _poolDao.acquireInLockTable(pool.getId()); if (pool == null) { - s_logger.warn("Failed to acquire lock on pool " + poolName); + logger.warn("Failed to acquire lock on pool " + poolName); throw new ConcurrentModificationException("Failed to acquire lock on pool " + poolName); } volume = new NetappVolumeVO(ipAddress, aggName, pool.getId(), volName, volSize, "", 0, username, password, 0, pool.getName()); @@ -419,34 +417,34 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { txn.commit(); } catch (NaException nae) { //zapi call failed, log and throw e - s_logger.warn("Failed to create volume on the netapp filer:", nae); + logger.warn("Failed to create volume on the netapp filer:", nae); txn.rollback(); if (volumeCreated) { try { deleteRogueVolume(volName, s);//deletes created volume on filer } catch (NaException e) { - s_logger.warn("Failed to cleanup created volume whilst rolling back on the netapp filer:", e); + logger.warn("Failed to cleanup created volume whilst rolling back on the netapp filer:", e); throw new ServerException("Unable to create volume via cloudtools." + "Failed to cleanup created volume on netapp filer whilst rolling back on the cloud db:", e); } catch (IOException e) { - s_logger.warn("Failed to cleanup created volume whilst rolling back on the netapp filer:", e); + logger.warn("Failed to cleanup created volume whilst rolling back on the netapp filer:", e); throw new ServerException("Unable to create volume via cloudtools." + "Failed to cleanup created volume on netapp filer whilst rolling back on the cloud db:", e); } } throw new ServerException("Unable to create volume", nae); } catch (IOException ioe) { - s_logger.warn("Failed to create volume on the netapp filer:", ioe); + logger.warn("Failed to create volume on the netapp filer:", ioe); txn.rollback(); if (volumeCreated) { try { deleteRogueVolume(volName, s);//deletes created volume on filer } catch (NaException e) { - s_logger.warn("Failed to cleanup created volume whilst rolling back on the netapp filer:", e); + logger.warn("Failed to cleanup created volume whilst rolling back on the netapp filer:", e); throw new ServerException("Unable to create volume via cloudtools." + "Failed to cleanup created volume on netapp filer whilst rolling back on the cloud db:", e); } catch (IOException e) { - s_logger.warn("Failed to cleanup created volume whilst rolling back on the netapp filer:", e); + logger.warn("Failed to cleanup created volume whilst rolling back on the netapp filer:", e); throw new ServerException("Unable to create volume via cloudtools." + "Failed to cleanup created volume on netapp filer whilst rolling back on the cloud db:", e); } @@ -497,7 +495,7 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { vol.setSnapshotPolicy(snapScheduleOnFiler); } catch (ServerException e) { - s_logger.warn("Error trying to get snapshot schedule for volume" + vol.getVolumeName()); + logger.warn("Error trying to get snapshot schedule for volume" + vol.getVolumeName()); } } return vols; @@ -538,10 +536,10 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { .append(whichMinutes); return sB.toString(); } catch (NaException nae) { - s_logger.warn("Failed to get volume size ", nae); + logger.warn("Failed to get volume size ", nae); throw new ServerException("Failed to get volume size", nae); } catch (IOException ioe) { - s_logger.warn("Failed to get volume size ", ioe); + logger.warn("Failed to get volume size ", ioe); throw new ServerException("Failed to get volume size", ioe); } finally { if (s != null) @@ -597,10 +595,10 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { } } catch (NaException nae) { - s_logger.warn("Failed to get volume size ", nae); + logger.warn("Failed to get volume size ", nae); throw new ServerException("Failed to get volume size", nae); } catch (IOException ioe) { - s_logger.warn("Failed to get volume size ", ioe); + logger.warn("Failed to get volume size ", ioe); throw new ServerException("Failed to get volume size", ioe); } finally { if (s != null) @@ -646,7 +644,7 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { } pool = _poolDao.acquireInLockTable(pool.getId()); if (pool == null) { - s_logger.warn("Failed to acquire lock on the pool " + poolName); + logger.warn("Failed to acquire lock on the pool " + poolName); return result; } NaServer s = null; @@ -663,8 +661,8 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { throw new ServerException("Could not find a suitable volume to create lun on"); } - if (s_logger.isDebugEnabled()) - s_logger.debug("Request --> createLun " + "serverIp:" + selectedVol.getIpAddress()); + if (logger.isDebugEnabled()) + logger.debug("Request --> createLun " + "serverIp:" + selectedVol.getIpAddress()); StringBuilder exportPath = new StringBuilder("/vol/"); exportPath.append(selectedVol.getVolumeName()); @@ -715,7 +713,7 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { } catch (NaAPIFailedException e) { if (e.getErrno() == 9004) { //igroup already exists hence no error - s_logger.warn("Igroup already exists"); + logger.warn("Igroup already exists"); } } @@ -794,15 +792,15 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { NetappVolumeVO vol = _volumeDao.acquireInLockTable(lun.getVolumeId()); if (vol == null) { - s_logger.warn("Failed to lock volume id= " + lun.getVolumeId()); + logger.warn("Failed to lock volume id= " + lun.getVolumeId()); return; } NaServer s = null; try { s = getServer(vol.getIpAddress(), vol.getUsername(), vol.getPassword()); - if (s_logger.isDebugEnabled()) - s_logger.debug("Request --> destroyLun " + ":serverIp:" + vol.getIpAddress()); + if (logger.isDebugEnabled()) + logger.debug("Request --> destroyLun " + ":serverIp:" + vol.getIpAddress()); try { //Unmap lun @@ -812,7 +810,7 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { s.invokeElem(xi2); } catch (NaAPIFailedException naf) { if (naf.getErrno() == 9016) - s_logger.warn("no map exists excpn 9016 caught in deletelun, continuing with delete"); + logger.warn("no map exists excpn 9016 caught in deletelun, continuing with delete"); } //destroy lun @@ -831,30 +829,30 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { txn.commit(); } catch (UnknownHostException uhe) { txn.rollback(); - s_logger.warn("Failed to delete lun", uhe); + logger.warn("Failed to delete lun", uhe); throw new ServerException("Failed to delete lun", uhe); } catch (IOException ioe) { txn.rollback(); - s_logger.warn("Failed to delete lun", ioe); + logger.warn("Failed to delete lun", ioe); throw new ServerException("Failed to delete lun", ioe); } catch (NaAPIFailedException naf) { if (naf.getErrno() == 9017) {//no such group exists excpn - s_logger.warn("no such group exists excpn 9017 caught in deletelun, continuing with delete"); + logger.warn("no such group exists excpn 9017 caught in deletelun, continuing with delete"); _lunDao.remove(lun.getId()); txn.commit(); } else if (naf.getErrno() == 9029) {//LUN maps for this initiator group exist - s_logger.warn("LUN maps for this initiator group exist errno 9029 caught in deletelun, continuing with delete"); + logger.warn("LUN maps for this initiator group exist errno 9029 caught in deletelun, continuing with delete"); _lunDao.remove(lun.getId()); txn.commit(); } else { txn.rollback(); - s_logger.warn("Failed to delete lun", naf); + logger.warn("Failed to delete lun", naf); throw new ServerException("Failed to delete lun", naf); } } catch (NaException nae) { txn.rollback(); - s_logger.warn("Failed to delete lun", nae); + logger.warn("Failed to delete lun", nae); throw new ServerException("Failed to delete lun", nae); } finally { if (vol != null) { @@ -875,8 +873,8 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { */ @Override public List<LunVO> listLunsOnFiler(String poolName) { - if (s_logger.isDebugEnabled()) - s_logger.debug("Request --> listLunsOnFiler "); + if (logger.isDebugEnabled()) + logger.debug("Request --> listLunsOnFiler "); List<LunVO> luns = new ArrayList<LunVO>(); @@ -886,8 +884,8 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { luns.addAll(_lunDao.listLunsByVolId(vol.getId())); } - if (s_logger.isDebugEnabled()) - s_logger.debug("Response --> listLunsOnFiler:success"); + if (logger.isDebugEnabled()) + logger.debug("Response --> listLunsOnFiler:success"); return luns; } @@ -910,8 +908,8 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { try { s = getServer(vol.getIpAddress(), vol.getUsername(), vol.getPassword()); - if (s_logger.isDebugEnabled()) - s_logger.debug("Request --> disassociateLun " + ":serverIp:" + vol.getIpAddress()); + if (logger.isDebugEnabled()) + logger.debug("Request --> disassociateLun " + ":serverIp:" + vol.getIpAddress()); xi = new NaElement("igroup-remove"); xi.addNewChild("force", "true"); @@ -972,8 +970,8 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { try { s = getServer(vol.getIpAddress(), vol.getUsername(), vol.getPassword()); - if (s_logger.isDebugEnabled()) - s_logger.debug("Request --> associateLun " + ":serverIp:" + vol.getIpAddress()); + if (logger.isDebugEnabled()) + logger.debug("Request --> associateLun " + ":serverIp:" + vol.getIpAddress()); //add iqn to the group xi2 = new NaElement("igroup-add"); @@ -984,19 +982,19 @@ public class NetappManagerImpl extends ManagerBase implements NetappManager { return returnVal; } catch (UnknownHostException uhe) { - s_logger.warn("Unable to associate LUN ", uhe); + logger.warn("Unable to associate LUN ", uhe); throw new ServerException("Unable to associate LUN", uhe); } catch (NaAPIFailedException naf) { if (naf.getErrno() == 9008) { //initiator group already contains node return returnVal; } - s_logger.warn("Unable to associate LUN ", naf); + logger.warn("Unable to associate LUN ", naf); throw new ServerException("Unable to associate LUN", naf); } catch (NaException nae) { - s_logger.warn("Unable to associate LUN ", nae); + logger.warn("Unable to associate LUN ", nae); throw new ServerException("Unable to associate LUN", nae); } catch (IOException ioe) { - s_logger.warn("Unable to associate LUN ", ioe); + logger.warn("Unable to associate LUN ", ioe); throw new ServerException("Unable to associate LUN", ioe); } finally { if (s != null) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/plugins/file-systems/netapp/src/com/cloud/netapp/dao/LunDaoImpl.java ---------------------------------------------------------------------- diff --git a/plugins/file-systems/netapp/src/com/cloud/netapp/dao/LunDaoImpl.java b/plugins/file-systems/netapp/src/com/cloud/netapp/dao/LunDaoImpl.java index 60a15b5..1bb2da8 100644 --- a/plugins/file-systems/netapp/src/com/cloud/netapp/dao/LunDaoImpl.java +++ b/plugins/file-systems/netapp/src/com/cloud/netapp/dao/LunDaoImpl.java @@ -20,7 +20,6 @@ import java.util.List; import javax.ejb.Local; -import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import com.cloud.netapp.LunVO; @@ -32,7 +31,6 @@ import com.cloud.utils.db.SearchCriteria; @Component @Local(value = {LunDao.class}) public class LunDaoImpl extends GenericDaoBase<LunVO, Long> implements LunDao { - private static final Logger s_logger = Logger.getLogger(PoolDaoImpl.class); protected final SearchBuilder<LunVO> LunSearch; protected final SearchBuilder<LunVO> LunNameSearch; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/plugins/file-systems/netapp/src/com/cloud/netapp/dao/PoolDaoImpl.java ---------------------------------------------------------------------- diff --git a/plugins/file-systems/netapp/src/com/cloud/netapp/dao/PoolDaoImpl.java b/plugins/file-systems/netapp/src/com/cloud/netapp/dao/PoolDaoImpl.java index 4ac76df..ff2573f 100644 --- a/plugins/file-systems/netapp/src/com/cloud/netapp/dao/PoolDaoImpl.java +++ b/plugins/file-systems/netapp/src/com/cloud/netapp/dao/PoolDaoImpl.java @@ -20,7 +20,6 @@ import java.util.List; import javax.ejb.Local; -import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import com.cloud.netapp.PoolVO; @@ -31,7 +30,6 @@ import com.cloud.utils.db.SearchCriteria; @Component @Local(value = {PoolDao.class}) public class PoolDaoImpl extends GenericDaoBase<PoolVO, Long> implements PoolDao { - private static final Logger s_logger = Logger.getLogger(PoolDaoImpl.class); protected final SearchBuilder<PoolVO> PoolSearch; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/plugins/file-systems/netapp/src/com/cloud/netapp/dao/VolumeDaoImpl.java ---------------------------------------------------------------------- diff --git a/plugins/file-systems/netapp/src/com/cloud/netapp/dao/VolumeDaoImpl.java b/plugins/file-systems/netapp/src/com/cloud/netapp/dao/VolumeDaoImpl.java index e239b1e..ea4fdbd 100644 --- a/plugins/file-systems/netapp/src/com/cloud/netapp/dao/VolumeDaoImpl.java +++ b/plugins/file-systems/netapp/src/com/cloud/netapp/dao/VolumeDaoImpl.java @@ -20,7 +20,6 @@ import java.util.List; import javax.ejb.Local; -import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import com.cloud.netapp.NetappVolumeVO; @@ -32,7 +31,6 @@ import com.cloud.utils.db.SearchCriteria; @Component(value = "netappVolumeDaoImpl") @Local(value = {VolumeDao.class}) public class VolumeDaoImpl extends GenericDaoBase<NetappVolumeVO, Long> implements VolumeDao { - private static final Logger s_logger = Logger.getLogger(VolumeDaoImpl.class); protected final SearchBuilder<NetappVolumeVO> NetappVolumeSearch; protected final SearchBuilder<NetappVolumeVO> NetappListVolumeSearch; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/plugins/ha-planners/skip-heurestics/src/com/cloud/deploy/SkipHeuresticsPlanner.java ---------------------------------------------------------------------- diff --git a/plugins/ha-planners/skip-heurestics/src/com/cloud/deploy/SkipHeuresticsPlanner.java b/plugins/ha-planners/skip-heurestics/src/com/cloud/deploy/SkipHeuresticsPlanner.java index b67d112..9ea3d82 100644 --- a/plugins/ha-planners/skip-heurestics/src/com/cloud/deploy/SkipHeuresticsPlanner.java +++ b/plugins/ha-planners/skip-heurestics/src/com/cloud/deploy/SkipHeuresticsPlanner.java @@ -17,7 +17,6 @@ package com.cloud.deploy; import com.cloud.vm.VirtualMachineProfile; -import org.apache.log4j.Logger; import javax.ejb.Local; @@ -27,7 +26,6 @@ import java.util.Map; @Local(value=HAPlanner.class) public class SkipHeuresticsPlanner extends FirstFitPlanner implements HAPlanner { - private static final Logger s_logger = Logger.getLogger(SkipHeuresticsPlanner.class); /** @@ -39,8 +37,8 @@ public class SkipHeuresticsPlanner extends FirstFitPlanner implements HAPlanner @Override protected void removeClustersCrossingThreshold(List<Long> clusterListForVmAllocation, ExcludeList avoid, VirtualMachineProfile vmProfile, DeploymentPlan plan){ - if (s_logger.isDebugEnabled()) { - s_logger.debug("Deploying vm during HA process, so skipping disable threshold check"); + if (logger.isDebugEnabled()) { + logger.debug("Deploying vm during HA process, so skipping disable threshold check"); } return; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/plugins/host-allocators/random/src/com/cloud/agent/manager/allocator/impl/RandomAllocator.java ---------------------------------------------------------------------- diff --git a/plugins/host-allocators/random/src/com/cloud/agent/manager/allocator/impl/RandomAllocator.java b/plugins/host-allocators/random/src/com/cloud/agent/manager/allocator/impl/RandomAllocator.java index 390a8af..1df6458 100644 --- a/plugins/host-allocators/random/src/com/cloud/agent/manager/allocator/impl/RandomAllocator.java +++ b/plugins/host-allocators/random/src/com/cloud/agent/manager/allocator/impl/RandomAllocator.java @@ -23,7 +23,6 @@ import java.util.List; import javax.ejb.Local; import javax.inject.Inject; -import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import com.cloud.agent.manager.allocator.HostAllocator; @@ -42,7 +41,6 @@ import com.cloud.vm.VirtualMachineProfile; @Component @Local(value = HostAllocator.class) public class RandomAllocator extends AdapterBase implements HostAllocator { - private static final Logger s_logger = Logger.getLogger(RandomAllocator.class); @Inject private HostDao _hostDao; @Inject @@ -69,9 +67,9 @@ public class RandomAllocator extends AdapterBase implements HostAllocator { String hostTag = offering.getHostTag(); if (hostTag != null) { - s_logger.debug("Looking for hosts in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId + " having host tag:" + hostTag); + logger.debug("Looking for hosts in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId + " having host tag:" + hostTag); } else { - s_logger.debug("Looking for hosts in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId); + logger.debug("Looking for hosts in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId); } // list all computing hosts, regardless of whether they support routing...it's random after all @@ -81,7 +79,7 @@ public class RandomAllocator extends AdapterBase implements HostAllocator { hostsCopy.retainAll(_resourceMgr.listAllUpAndEnabledHosts(type, clusterId, podId, dcId)); } - s_logger.debug("Random Allocator found " + hostsCopy.size() + " hosts"); + logger.debug("Random Allocator found " + hostsCopy.size() + " hosts"); if (hostsCopy.size() == 0) { return suitableHosts; } @@ -95,14 +93,14 @@ public class RandomAllocator extends AdapterBase implements HostAllocator { if (!avoid.shouldAvoid(host)) { suitableHosts.add(host); } else { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Host name: " + host.getName() + ", hostId: " + host.getId() + " is in avoid set, " + "skipping this and trying other available hosts"); + if (logger.isDebugEnabled()) { + logger.debug("Host name: " + host.getName() + ", hostId: " + host.getId() + " is in avoid set, " + "skipping this and trying other available hosts"); } } } - if (s_logger.isDebugEnabled()) { - s_logger.debug("Random Host Allocator returning " + suitableHosts.size() + " suitable hosts"); + if (logger.isDebugEnabled()) { + logger.debug("Random Host Allocator returning " + suitableHosts.size() + " suitable hosts"); } return suitableHosts; @@ -124,9 +122,9 @@ public class RandomAllocator extends AdapterBase implements HostAllocator { String hostTag = offering.getHostTag(); if (hostTag != null) { - s_logger.debug("Looking for hosts in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId + " having host tag:" + hostTag); + logger.debug("Looking for hosts in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId + " having host tag:" + hostTag); } else { - s_logger.debug("Looking for hosts in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId); + logger.debug("Looking for hosts in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId); } // list all computing hosts, regardless of whether they support routing...it's random after all @@ -137,7 +135,7 @@ public class RandomAllocator extends AdapterBase implements HostAllocator { hosts = _resourceMgr.listAllUpAndEnabledHosts(type, clusterId, podId, dcId); } - s_logger.debug("Random Allocator found " + hosts.size() + " hosts"); + logger.debug("Random Allocator found " + hosts.size() + " hosts"); if (hosts.size() == 0) { return suitableHosts; @@ -152,13 +150,13 @@ public class RandomAllocator extends AdapterBase implements HostAllocator { if (!avoid.shouldAvoid(host)) { suitableHosts.add(host); } else { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Host name: " + host.getName() + ", hostId: " + host.getId() + " is in avoid set, skipping this and trying other available hosts"); + if (logger.isDebugEnabled()) { + logger.debug("Host name: " + host.getName() + ", hostId: " + host.getId() + " is in avoid set, skipping this and trying other available hosts"); } } } - if (s_logger.isDebugEnabled()) { - s_logger.debug("Random Host Allocator returning " + suitableHosts.size() + " suitable hosts"); + if (logger.isDebugEnabled()) { + logger.debug("Random Host Allocator returning " + suitableHosts.size() + " suitable hosts"); } return suitableHosts; }
