http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/plugins/user-authenticators/sha256salted/src/com/cloud/server/auth/SHA256SaltedUserAuthenticator.java ---------------------------------------------------------------------- diff --git a/plugins/user-authenticators/sha256salted/src/com/cloud/server/auth/SHA256SaltedUserAuthenticator.java b/plugins/user-authenticators/sha256salted/src/com/cloud/server/auth/SHA256SaltedUserAuthenticator.java index e35c29d..d23679f 100644 --- a/plugins/user-authenticators/sha256salted/src/com/cloud/server/auth/SHA256SaltedUserAuthenticator.java +++ b/plugins/user-authenticators/sha256salted/src/com/cloud/server/auth/SHA256SaltedUserAuthenticator.java @@ -21,7 +21,6 @@ import com.cloud.user.dao.UserAccountDao; import com.cloud.utils.Pair; import com.cloud.utils.exception.CloudRuntimeException; import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; import org.bouncycastle.util.encoders.Base64; import javax.ejb.Local; @@ -34,7 +33,6 @@ import java.util.Map; @Local(value = {UserAuthenticator.class}) public class SHA256SaltedUserAuthenticator extends DefaultUserAuthenticator { - public static final Logger s_logger = Logger.getLogger(SHA256SaltedUserAuthenticator.class); private static final String s_defaultPassword = "000000000000000000000000000="; private static final String s_defaultSalt = "0000000000000000000000000000000="; @Inject @@ -46,19 +44,19 @@ public class SHA256SaltedUserAuthenticator extends DefaultUserAuthenticator { */ @Override public Pair<Boolean, ActionOnFailedAuthentication> authenticate(String username, String password, Long domainId, Map<String, Object[]> requestParameters) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Retrieving user: " + username); + if (logger.isDebugEnabled()) { + logger.debug("Retrieving user: " + username); } if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) { - s_logger.debug("Username or Password cannot be empty"); + logger.debug("Username or Password cannot be empty"); return new Pair<Boolean, ActionOnFailedAuthentication>(false, null); } boolean realUser = true; UserAccount user = _userAccountDao.getUserAccount(username, domainId); if (user == null) { - s_logger.debug("Unable to find user with " + username + " in domain " + domainId); + logger.debug("Unable to find user with " + username + " in domain " + domainId); realUser = false; } /* Fake Data */ @@ -67,7 +65,7 @@ public class SHA256SaltedUserAuthenticator extends DefaultUserAuthenticator { if (realUser) { String storedPassword[] = user.getPassword().split(":"); if (storedPassword.length != 2) { - s_logger.warn("The stored password for " + username + " isn't in the right format for this authenticator"); + logger.warn("The stored password for " + username + " isn't in the right format for this authenticator"); realUser = false; } else { realPassword = storedPassword[1];
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java b/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java index 3a2b280..9fc0f16 100644 --- a/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java +++ b/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java @@ -27,7 +27,6 @@ import javax.inject.Inject; import javax.naming.ConfigurationException; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; -import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import com.cloud.agent.manager.allocator.HostAllocator; @@ -69,7 +68,6 @@ import com.cloud.vm.dao.VMInstanceDao; @Component @Local(value = {HostAllocator.class}) public class FirstFitAllocator extends AdapterBase implements HostAllocator { - private static final Logger s_logger = Logger.getLogger(FirstFitAllocator.class); @Inject protected HostDao _hostDao = null; @Inject @@ -119,8 +117,8 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { return new ArrayList<Host>(); } - if (s_logger.isDebugEnabled()) { - s_logger.debug("Looking for hosts in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId); + if (logger.isDebugEnabled()) { + logger.debug("Looking for hosts in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId); } String hostTagOnOffering = offering.getHostTag(); @@ -141,29 +139,29 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { List<HostVO> hostsMatchingOfferingTag = new ArrayList<HostVO>(); List<HostVO> hostsMatchingTemplateTag = new ArrayList<HostVO>(); if (hasSvcOfferingTag) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Looking for hosts having tag specified on SvcOffering:" + hostTagOnOffering); + if (logger.isDebugEnabled()) { + logger.debug("Looking for hosts having tag specified on SvcOffering:" + hostTagOnOffering); } hostsMatchingOfferingTag = _hostDao.listByHostTag(type, clusterId, podId, dcId, hostTagOnOffering); - if (s_logger.isDebugEnabled()) { - s_logger.debug("Hosts with tag '" + hostTagOnOffering + "' are:" + hostsMatchingOfferingTag); + if (logger.isDebugEnabled()) { + logger.debug("Hosts with tag '" + hostTagOnOffering + "' are:" + hostsMatchingOfferingTag); } } if (hasTemplateTag) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Looking for hosts having tag specified on Template:" + hostTagOnTemplate); + if (logger.isDebugEnabled()) { + logger.debug("Looking for hosts having tag specified on Template:" + hostTagOnTemplate); } hostsMatchingTemplateTag = _hostDao.listByHostTag(type, clusterId, podId, dcId, hostTagOnTemplate); - if (s_logger.isDebugEnabled()) { - s_logger.debug("Hosts with tag '" + hostTagOnTemplate + "' are:" + hostsMatchingTemplateTag); + if (logger.isDebugEnabled()) { + logger.debug("Hosts with tag '" + hostTagOnTemplate + "' are:" + hostsMatchingTemplateTag); } } if (hasSvcOfferingTag && hasTemplateTag) { hostsMatchingOfferingTag.retainAll(hostsMatchingTemplateTag); clusterHosts = _hostDao.listByHostTag(type, clusterId, podId, dcId, hostTagOnTemplate); - if (s_logger.isDebugEnabled()) { - s_logger.debug("Found " + hostsMatchingOfferingTag.size() + " Hosts satisfying both tags, host ids are:" + hostsMatchingOfferingTag); + if (logger.isDebugEnabled()) { + logger.debug("Found " + hostsMatchingOfferingTag.size() + " Hosts satisfying both tags, host ids are:" + hostsMatchingOfferingTag); } clusterHosts = hostsMatchingOfferingTag; @@ -218,25 +216,25 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { hostsCopy.retainAll(_resourceMgr.listAllUpAndEnabledNonHAHosts(type, clusterId, podId, dcId)); } else { if (hasSvcOfferingTag) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Looking for hosts having tag specified on SvcOffering:" + hostTagOnOffering); + if (logger.isDebugEnabled()) { + logger.debug("Looking for hosts having tag specified on SvcOffering:" + hostTagOnOffering); } hostsCopy.retainAll(_hostDao.listByHostTag(type, clusterId, podId, dcId, hostTagOnOffering)); - if (s_logger.isDebugEnabled()) { - s_logger.debug("Hosts with tag '" + hostTagOnOffering + "' are:" + hostsCopy); + if (logger.isDebugEnabled()) { + logger.debug("Hosts with tag '" + hostTagOnOffering + "' are:" + hostsCopy); } } if (hasTemplateTag) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Looking for hosts having tag specified on Template:" + hostTagOnTemplate); + if (logger.isDebugEnabled()) { + logger.debug("Looking for hosts having tag specified on Template:" + hostTagOnTemplate); } hostsCopy.retainAll(_hostDao.listByHostTag(type, clusterId, podId, dcId, hostTagOnTemplate)); - if (s_logger.isDebugEnabled()) { - s_logger.debug("Hosts with tag '" + hostTagOnTemplate + "' are:" + hostsCopy); + if (logger.isDebugEnabled()) { + logger.debug("Hosts with tag '" + hostTagOnTemplate + "' are:" + hostsCopy); } } } @@ -260,20 +258,20 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { hosts = reorderHostsByCapacity(plan, hosts); } - if (s_logger.isDebugEnabled()) { - s_logger.debug("FirstFitAllocator has " + hosts.size() + " hosts to check for allocation: " + hosts); + if (logger.isDebugEnabled()) { + logger.debug("FirstFitAllocator has " + hosts.size() + " hosts to check for allocation: " + hosts); } // We will try to reorder the host lists such that we give priority to hosts that have // the minimums to support a VM's requirements hosts = prioritizeHosts(template, offering, hosts); - if (s_logger.isDebugEnabled()) { - s_logger.debug("Found " + hosts.size() + " hosts for allocation after prioritization: " + hosts); + if (logger.isDebugEnabled()) { + logger.debug("Found " + hosts.size() + " hosts for allocation after prioritization: " + hosts); } - if (s_logger.isDebugEnabled()) { - s_logger.debug("Looking for speed=" + (offering.getCpu() * offering.getSpeed()) + "Mhz, Ram=" + offering.getRamSize()); + if (logger.isDebugEnabled()) { + logger.debug("Looking for speed=" + (offering.getCpu() * offering.getSpeed()) + "Mhz, Ram=" + offering.getRamSize()); } long serviceOfferingId = offering.getId(); @@ -285,16 +283,16 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { break; } if (avoid.shouldAvoid(host)) { - 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"); } continue; } //find number of guest VMs occupying capacity on this host. if (_capacityMgr.checkIfHostReachMaxGuestLimit(host)) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Host name: " + host.getName() + ", hostId: " + host.getId() + + if (logger.isDebugEnabled()) { + logger.debug("Host name: " + host.getName() + ", hostId: " + host.getId() + " already has max Running VMs(count includes system VMs), skipping this and trying other available hosts"); } continue; @@ -304,7 +302,7 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { if ((offeringDetails = _serviceOfferingDetailsDao.findDetail(serviceOfferingId, GPU.Keys.vgpuType.toString())) != null) { ServiceOfferingDetailsVO groupName = _serviceOfferingDetailsDao.findDetail(serviceOfferingId, GPU.Keys.pciDevice.toString()); if(!_resourceMgr.isGPUDeviceAvailable(host.getId(), groupName.getValue(), offeringDetails.getValue())){ - s_logger.info("Host name: " + host.getName() + ", hostId: "+ host.getId() +" does not have required GPU devices available"); + logger.info("Host name: " + host.getName() + ", hostId: "+ host.getId() +" does not have required GPU devices available"); continue; } } @@ -322,20 +320,20 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { considerReservedCapacity); if (hostHasCpuCapability && hostHasCapacity) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Found a suitable host, adding to list: " + host.getId()); + if (logger.isDebugEnabled()) { + logger.debug("Found a suitable host, adding to list: " + host.getId()); } suitableHosts.add(host); } else { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Not using host " + host.getId() + "; host has cpu capability? " + hostHasCpuCapability + ", host has capacity?" + hostHasCapacity); + if (logger.isDebugEnabled()) { + logger.debug("Not using host " + host.getId() + "; host has cpu capability? " + hostHasCpuCapability + ", host has capacity?" + hostHasCapacity); } avoid.addHost(host.getId()); } } - if (s_logger.isDebugEnabled()) { - s_logger.debug("Host Allocator returning " + suitableHosts.size() + " suitable hosts"); + if (logger.isDebugEnabled()) { + logger.debug("Host Allocator returning " + suitableHosts.size() + " suitable hosts"); } return suitableHosts; @@ -351,8 +349,8 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { capacityType = CapacityVO.CAPACITY_TYPE_MEMORY; } List<Long> hostIdsByFreeCapacity = _capacityDao.orderHostsByFreeCapacity(clusterId, capacityType); - if (s_logger.isDebugEnabled()) { - s_logger.debug("List of hosts in descending order of free capacity in the cluster: "+ hostIdsByFreeCapacity); + if (logger.isDebugEnabled()) { + logger.debug("List of hosts in descending order of free capacity in the cluster: "+ hostIdsByFreeCapacity); } //now filter the given list of Hosts by this ordered list @@ -381,8 +379,8 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { Long clusterId = plan.getClusterId(); List<Long> hostIdsByVmCount = _vmInstanceDao.listHostIdsByVmCount(dcId, podId, clusterId, account.getAccountId()); - if (s_logger.isDebugEnabled()) { - s_logger.debug("List of hosts in ascending order of number of VMs: " + hostIdsByVmCount); + if (logger.isDebugEnabled()) { + logger.debug("List of hosts in ascending order of number of VMs: " + hostIdsByVmCount); } //now filter the given list of Hosts by this ordered list @@ -434,9 +432,9 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator { hostsToCheck.addAll(hosts); } - if (s_logger.isDebugEnabled()) { + if (logger.isDebugEnabled()) { if (noHvmHosts.size() > 0) { - s_logger.debug("Not considering hosts: " + noHvmHosts + " to deploy template: " + template + " as they are not HVM enabled"); + logger.debug("Not considering hosts: " + noHvmHosts + " to deploy template: " + template + " as they are not HVM enabled"); } } // If a host is tagged with the same guest OS category as the template, move it to a high priority list http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/server/src/com/cloud/agent/manager/allocator/impl/RecreateHostAllocator.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/agent/manager/allocator/impl/RecreateHostAllocator.java b/server/src/com/cloud/agent/manager/allocator/impl/RecreateHostAllocator.java index 161c965..c2d1abd 100644 --- a/server/src/com/cloud/agent/manager/allocator/impl/RecreateHostAllocator.java +++ b/server/src/com/cloud/agent/manager/allocator/impl/RecreateHostAllocator.java @@ -27,7 +27,6 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; @@ -58,7 +57,6 @@ import com.cloud.vm.VirtualMachineProfile; @Component @Local(value = HostAllocator.class) public class RecreateHostAllocator extends FirstFitRoutingAllocator { - private final static Logger s_logger = Logger.getLogger(RecreateHostAllocator.class); @Inject HostPodDao _podDao; @@ -83,10 +81,10 @@ public class RecreateHostAllocator extends FirstFitRoutingAllocator { return hosts; } - s_logger.debug("First fit was unable to find a host"); + logger.debug("First fit was unable to find a host"); VirtualMachine.Type vmType = vm.getType(); if (vmType == VirtualMachine.Type.User) { - s_logger.debug("vm is not a system vm so let's just return empty list"); + logger.debug("vm is not a system vm so let's just return empty list"); return new ArrayList<Host>(); } @@ -95,11 +93,11 @@ public class RecreateHostAllocator extends FirstFitRoutingAllocator { //getting rid of direct.attached.untagged.vlan.enabled config param: Bug 7204 //basic network type for zone maps to direct untagged case if (dc.getNetworkType().equals(NetworkType.Basic)) { - s_logger.debug("Direct Networking mode so we can only allow the host to be allocated in the same pod due to public ip address cannot change"); + logger.debug("Direct Networking mode so we can only allow the host to be allocated in the same pod due to public ip address cannot change"); List<VolumeVO> vols = _volsDao.findByInstance(vm.getId()); VolumeVO vol = vols.get(0); long podId = vol.getPodId(); - s_logger.debug("Pod id determined from volume " + vol.getId() + " is " + podId); + logger.debug("Pod id determined from volume " + vol.getId() + " is " + podId); Iterator<PodCluster> it = pcs.iterator(); while (it.hasNext()) { PodCluster pc = it.next(); @@ -120,22 +118,22 @@ public class RecreateHostAllocator extends FirstFitRoutingAllocator { } for (Pair<Long, Long> pcId : avoidPcs) { - s_logger.debug("Removing " + pcId + " from the list of available pods"); + logger.debug("Removing " + pcId + " from the list of available pods"); pcs.remove(new PodCluster(new HostPodVO(pcId.first()), pcId.second() != null ? new ClusterVO(pcId.second()) : null)); } for (PodCluster p : pcs) { if (p.getPod().getAllocationState() != Grouping.AllocationState.Enabled) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Pod name: " + p.getPod().getName() + ", podId: " + p.getPod().getId() + " is in " + p.getPod().getAllocationState().name() + + if (logger.isDebugEnabled()) { + logger.debug("Pod name: " + p.getPod().getName() + ", podId: " + p.getPod().getId() + " is in " + p.getPod().getAllocationState().name() + " state, skipping this and trying other pods"); } continue; } Long clusterId = p.getCluster() == null ? null : p.getCluster().getId(); if (p.getCluster() != null && p.getCluster().getAllocationState() != Grouping.AllocationState.Enabled) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Cluster name: " + p.getCluster().getName() + ", clusterId: " + clusterId + " is in " + p.getCluster().getAllocationState().name() + + if (logger.isDebugEnabled()) { + logger.debug("Cluster name: " + p.getCluster().getName() + ", clusterId: " + clusterId + " is in " + p.getCluster().getAllocationState().name() + " state, skipping this and trying other pod-clusters"); } continue; @@ -148,7 +146,7 @@ public class RecreateHostAllocator extends FirstFitRoutingAllocator { } - s_logger.debug("Unable to find any available pods at all!"); + logger.debug("Unable to find any available pods at all!"); return new ArrayList<Host>(); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/server/src/com/cloud/agent/manager/allocator/impl/UserConcentratedAllocator.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/agent/manager/allocator/impl/UserConcentratedAllocator.java b/server/src/com/cloud/agent/manager/allocator/impl/UserConcentratedAllocator.java index 885032e..0f4b470 100644 --- a/server/src/com/cloud/agent/manager/allocator/impl/UserConcentratedAllocator.java +++ b/server/src/com/cloud/agent/manager/allocator/impl/UserConcentratedAllocator.java @@ -27,7 +27,6 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; @@ -60,7 +59,6 @@ import com.cloud.vm.dao.VMInstanceDao; @Local(value = PodAllocator.class) public class UserConcentratedAllocator extends AdapterBase implements PodAllocator { - private final static Logger s_logger = Logger.getLogger(UserConcentratedAllocator.class); @Inject UserVmDao _vmDao; @@ -89,7 +87,7 @@ public class UserConcentratedAllocator extends AdapterBase implements PodAllocat List<HostPodVO> podsInZone = _podDao.listByDataCenterId(zoneId); if (podsInZone.size() == 0) { - s_logger.debug("No pods found in zone " + zone.getName()); + logger.debug("No pods found in zone " + zone.getName()); return null; } @@ -112,8 +110,8 @@ public class UserConcentratedAllocator extends AdapterBase implements PodAllocat dataCenterAndPodHasEnoughCapacity(zoneId, podId, (offering.getRamSize()) * 1024L * 1024L, Capacity.CAPACITY_TYPE_MEMORY, hostCandiates); if (!enoughCapacity) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Not enough RAM available in zone/pod to allocate storage for user VM (zone: " + zoneId + ", pod: " + podId + ")"); + if (logger.isDebugEnabled()) { + logger.debug("Not enough RAM available in zone/pod to allocate storage for user VM (zone: " + zoneId + ", pod: " + podId + ")"); } continue; } @@ -122,8 +120,8 @@ public class UserConcentratedAllocator extends AdapterBase implements PodAllocat enoughCapacity = dataCenterAndPodHasEnoughCapacity(zoneId, podId, ((long)offering.getCpu() * offering.getSpeed()), Capacity.CAPACITY_TYPE_CPU, hostCandiates); if (!enoughCapacity) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Not enough cpu available in zone/pod to allocate storage for user VM (zone: " + zoneId + ", pod: " + podId + ")"); + if (logger.isDebugEnabled()) { + logger.debug("Not enough cpu available in zone/pod to allocate storage for user VM (zone: " + zoneId + ", pod: " + podId + ")"); } continue; } @@ -147,13 +145,13 @@ public class UserConcentratedAllocator extends AdapterBase implements PodAllocat } if (availablePods.size() == 0) { - s_logger.debug("There are no pods with enough memory/CPU capacity in zone " + zone.getName()); + logger.debug("There are no pods with enough memory/CPU capacity in zone " + zone.getName()); return null; } else { // Return a random pod int next = _rand.nextInt(availablePods.size()); HostPodVO selectedPod = availablePods.get(next); - s_logger.debug("Found pod " + selectedPod.getName() + " in zone " + zone.getName()); + logger.debug("Found pod " + selectedPod.getName() + " in zone " + zone.getName()); return new Pair<Pod, Long>(selectedPod, podHostCandidates.get(selectedPod.getId())); } } @@ -165,9 +163,9 @@ public class UserConcentratedAllocator extends AdapterBase implements PodAllocat sc.addAnd("capacityType", SearchCriteria.Op.EQ, capacityType); sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, dataCenterId); sc.addAnd("podId", SearchCriteria.Op.EQ, podId); - s_logger.trace("Executing search"); + logger.trace("Executing search"); capacities = _capacityDao.search(sc, null); - s_logger.trace("Done with a search"); + logger.trace("Done with a search"); boolean enoughCapacity = false; if (capacities != null) { @@ -196,8 +194,8 @@ public class UserConcentratedAllocator extends AdapterBase implements PodAllocat private boolean skipCalculation(VMInstanceVO vm) { if (vm.getState() == State.Expunging) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Skip counting capacity for Expunging VM : " + vm.getInstanceName()); + if (logger.isDebugEnabled()) { + logger.debug("Skip counting capacity for Expunging VM : " + vm.getInstanceName()); } return true; } @@ -217,8 +215,8 @@ public class UserConcentratedAllocator extends AdapterBase implements PodAllocat long millisecondsSinceLastUpdate = DateUtil.currentGMTTime().getTime() - vm.getUpdateTime().getTime(); if (millisecondsSinceLastUpdate > secondsToSkipVMs * 1000L) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Skip counting " + vm.getState().toString() + " vm " + vm.getInstanceName() + " in capacity allocation as it has been " + + if (logger.isDebugEnabled()) { + logger.debug("Skip counting " + vm.getState().toString() + " vm " + vm.getInstanceName() + " in capacity allocation as it has been " + vm.getState().toString().toLowerCase() + " for " + millisecondsSinceLastUpdate / 60000 + " minutes"); } return true; @@ -262,15 +260,15 @@ public class UserConcentratedAllocator extends AdapterBase implements PodAllocat if (capacityType == Capacity.CAPACITY_TYPE_MEMORY) { usedCapacity += so.getRamSize() * 1024L * 1024L; - if (s_logger.isDebugEnabled()) { - s_logger.debug("Counting memory capacity used by vm: " + vm.getId() + ", size: " + so.getRamSize() + "MB, host: " + hostId + ", currently counted: " + + if (logger.isDebugEnabled()) { + logger.debug("Counting memory capacity used by vm: " + vm.getId() + ", size: " + so.getRamSize() + "MB, host: " + hostId + ", currently counted: " + usedCapacity + " Bytes"); } } else if (capacityType == Capacity.CAPACITY_TYPE_CPU) { usedCapacity += so.getCpu() * so.getSpeed(); - if (s_logger.isDebugEnabled()) { - s_logger.debug("Counting cpu capacity used by vm: " + vm.getId() + ", cpu: " + so.getCpu() + ", speed: " + so.getSpeed() + ", currently counted: " + + if (logger.isDebugEnabled()) { + logger.debug("Counting cpu capacity used by vm: " + vm.getId() + ", cpu: " + so.getCpu() + ", speed: " + so.getSpeed() + ", currently counted: " + usedCapacity + " Bytes"); } } @@ -287,9 +285,9 @@ public class UserConcentratedAllocator extends AdapterBase implements PodAllocat * List<VMTemplateStoragePoolVO> tpvoList = _templatePoolDao.listByTemplateStatus(templateId, dcId, podId, * Status.DOWNLOADED); * - * if (thvoList != null && thvoList.size() > 0) { if (s_logger.isDebugEnabled()) { s_logger.debug("Found " + + * if (thvoList != null && thvoList.size() > 0) { if (logger.isDebugEnabled()) { logger.debug("Found " + * thvoList.size() + " storage hosts in pod " + podId + " with template " + templateId); } return true; } else if - * (tpvoList != null && tpvoList.size() > 0) { if (s_logger.isDebugEnabled()) { s_logger.debug("Found " + + * (tpvoList != null && tpvoList.size() > 0) { if (logger.isDebugEnabled()) { logger.debug("Found " + * tpvoList.size() + " storage pools in pod " + podId + " with template " + templateId); } return true; }else { return * false; } */ http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/server/src/com/cloud/agent/manager/authn/impl/BasicAgentAuthManager.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/agent/manager/authn/impl/BasicAgentAuthManager.java b/server/src/com/cloud/agent/manager/authn/impl/BasicAgentAuthManager.java index 1aa8f91..24d3dfd 100644 --- a/server/src/com/cloud/agent/manager/authn/impl/BasicAgentAuthManager.java +++ b/server/src/com/cloud/agent/manager/authn/impl/BasicAgentAuthManager.java @@ -22,7 +22,6 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; @@ -39,7 +38,6 @@ import com.cloud.utils.component.AdapterBase; @Component @Local(value = {AgentAuthorizer.class, StartupCommandProcessor.class}) public class BasicAgentAuthManager extends AdapterBase implements AgentAuthorizer, StartupCommandProcessor { - private static final Logger s_logger = Logger.getLogger(BasicAgentAuthManager.class); @Inject HostDao _hostDao = null; @Inject @@ -54,7 +52,7 @@ public class BasicAgentAuthManager extends AdapterBase implements AgentAuthorize } catch (AgentAuthnException e) { throw new ConnectionException(true, "Failed to authenticate/authorize", e); } - s_logger.debug("Authorized agent with guid " + cmd[0].getGuid()); + logger.debug("Authorized agent with guid " + cmd[0].getGuid()); return false;//so that the next host creator can process it } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/server/src/com/cloud/alert/AlertManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/alert/AlertManagerImpl.java b/server/src/com/cloud/alert/AlertManagerImpl.java index 8653069..41a9dff 100644 --- a/server/src/com/cloud/alert/AlertManagerImpl.java +++ b/server/src/com/cloud/alert/AlertManagerImpl.java @@ -40,7 +40,6 @@ import javax.mail.URLName; import javax.mail.internet.InternetAddress; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; import com.sun.mail.smtp.SMTPMessage; import com.sun.mail.smtp.SMTPSSLTransport; @@ -89,8 +88,6 @@ import com.cloud.utils.db.SearchCriteria; @Local(value = {AlertManager.class}) public class AlertManagerImpl extends ManagerBase implements AlertManager, Configurable { - private static final Logger s_logger = Logger.getLogger(AlertManagerImpl.class.getName()); - private static final Logger s_alertsLogger = Logger.getLogger("org.apache.cloudstack.alerts"); private static final long INITIAL_CAPACITY_CHECK_DELAY = 30L * 1000L; // thirty seconds expressed in milliseconds @@ -235,7 +232,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi _emailAlert.clearAlert(alertType.getType(), dataCenterId, podId); } } catch (Exception ex) { - s_logger.error("Problem clearing email alert", ex); + logger.error("Problem clearing email alert", ex); } } @@ -251,11 +248,11 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi if (_emailAlert != null) { _emailAlert.sendAlert(alertType, dataCenterId, podId, null, subject, body); } else { - s_alertsLogger.warn(" alertType:: " + alertType + " // dataCenterId:: " + dataCenterId + " // podId:: " + podId + + logger.warn(" alertType:: " + alertType + " // dataCenterId:: " + dataCenterId + " // podId:: " + podId + " // message:: " + subject + " // body:: " + body); } } catch (Exception ex) { - s_logger.error("Problem sending email alert", ex); + logger.error("Problem sending email alert", ex); } } @@ -270,9 +267,9 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi try { - if (s_logger.isDebugEnabled()) { - s_logger.debug("recalculating system capacity"); - s_logger.debug("Executing cpu/ram capacity update"); + if (logger.isDebugEnabled()) { + logger.debug("recalculating system capacity"); + logger.debug("Executing cpu/ram capacity update"); } // Calculate CPU and RAM capacities @@ -283,9 +280,9 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi _capacityMgr.updateCapacityForHost(host); } } - if (s_logger.isDebugEnabled()) { - s_logger.debug("Done executing cpu/ram capacity update"); - s_logger.debug("Executing storage capacity update"); + if (logger.isDebugEnabled()) { + logger.debug("Done executing cpu/ram capacity update"); + logger.debug("Executing storage capacity update"); } // Calculate storage pool capacity List<StoragePoolVO> storagePools = _storagePoolDao.listAll(); @@ -298,9 +295,9 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi } } - if (s_logger.isDebugEnabled()) { - s_logger.debug("Done executing storage capacity update"); - s_logger.debug("Executing capacity updates for public ip and Vlans"); + if (logger.isDebugEnabled()) { + logger.debug("Done executing storage capacity update"); + logger.debug("Executing capacity updates for public ip and Vlans"); } List<DataCenterVO> datacenters = _dcDao.listAll(); @@ -327,9 +324,9 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi } } - if (s_logger.isDebugEnabled()) { - s_logger.debug("Done capacity updates for public ip and Vlans"); - s_logger.debug("Executing capacity updates for private ip"); + if (logger.isDebugEnabled()) { + logger.debug("Done capacity updates for public ip and Vlans"); + logger.debug("Executing capacity updates for private ip"); } // Calculate new Private IP capacity @@ -341,13 +338,13 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi createOrUpdateIpCapacity(dcId, podId, Capacity.CAPACITY_TYPE_PRIVATE_IP, _configMgr.findPodAllocationState(pod)); } - if (s_logger.isDebugEnabled()) { - s_logger.debug("Done executing capacity updates for private ip"); - s_logger.debug("Done recalculating system capacity"); + if (logger.isDebugEnabled()) { + logger.debug("Done executing capacity updates for private ip"); + logger.debug("Done recalculating system capacity"); } } catch (Throwable t) { - s_logger.error("Caught exception in recalculating capacity", t); + logger.error("Caught exception in recalculating capacity", t); } } @@ -420,11 +417,11 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi @Override protected void runInContext() { try { - s_logger.debug("Running Capacity Checker ... "); + logger.debug("Running Capacity Checker ... "); checkForAlerts(); - s_logger.debug("Done running Capacity Checker ... "); + logger.debug("Done running Capacity Checker ... "); } catch (Throwable t) { - s_logger.error("Exception in CapacityChecker", t); + logger.error("Exception in CapacityChecker", t); } } } @@ -632,13 +629,13 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi } try { - if (s_logger.isDebugEnabled()) { - s_logger.debug(msgSubject); - s_logger.debug(msgContent); + if (logger.isDebugEnabled()) { + logger.debug(msgSubject); + logger.debug(msgContent); } _emailAlert.sendAlert(alertType, dc.getId(), podId, clusterId, msgSubject, msgContent); } catch (Exception ex) { - s_logger.error("Exception in CapacityChecker", ex); + logger.error("Exception in CapacityChecker", ex); } } @@ -694,7 +691,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi try { _recipientList[i] = new InternetAddress(recipientList[i], recipientList[i]); } catch (Exception ex) { - s_logger.error("Exception creating address for: " + recipientList[i], ex); + logger.error("Exception creating address for: " + recipientList[i], ex); } } } @@ -749,7 +746,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi // TODO: make sure this handles SSL transport (useAuth is true) and regular public void sendAlert(AlertType alertType, long dataCenterId, Long podId, Long clusterId, String subject, String content) throws MessagingException, UnsupportedEncodingException { - s_alertsLogger.warn(" alertType:: " + alertType + " // dataCenterId:: " + dataCenterId + " // podId:: " + + logger.warn(" alertType:: " + alertType + " // dataCenterId:: " + dataCenterId + " // podId:: " + podId + " // clusterId:: " + clusterId + " // message:: " + subject); AlertVO alert = null; if ((alertType != AlertManager.AlertType.ALERT_TYPE_HOST) && @@ -776,8 +773,8 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi newAlert.setName(alertType.getName()); _alertDao.persist(newAlert); } else { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Have already sent: " + alert.getSentCount() + " emails for alert type '" + alertType + "' -- skipping send email"); + if (logger.isDebugEnabled()) { + logger.debug("Have already sent: " + alert.getSentCount() + " emails for alert type '" + alertType + "' -- skipping send email"); } return; } @@ -813,9 +810,9 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi smtpTrans.sendMessage(msg, msg.getAllRecipients()); smtpTrans.close(); } catch (SendFailedException e) { - s_logger.error(" Failed to send email alert " + e); + logger.error(" Failed to send email alert " + e); } catch (MessagingException e) { - s_logger.error(" Failed to send email alert " + e); + logger.error(" Failed to send email alert " + e); } } }); @@ -859,7 +856,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi sendAlert(alertType, dataCenterId, podId, msg, msg); return true; } catch (Exception ex) { - s_logger.warn("Failed to generate an alert of type=" + alertType + "; msg=" + msg); + logger.warn("Failed to generate an alert of type=" + alertType + "; msg=" + msg); return false; } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/server/src/com/cloud/alert/ClusterAlertAdapter.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/alert/ClusterAlertAdapter.java b/server/src/com/cloud/alert/ClusterAlertAdapter.java index ccb1074..db1e5ce 100644 --- a/server/src/com/cloud/alert/ClusterAlertAdapter.java +++ b/server/src/com/cloud/alert/ClusterAlertAdapter.java @@ -22,7 +22,6 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import com.cloud.cluster.ClusterManager; @@ -38,7 +37,6 @@ import com.cloud.utils.events.SubscriptionMgr; @Local(value = AlertAdapter.class) public class ClusterAlertAdapter extends AdapterBase implements AlertAdapter { - private static final Logger s_logger = Logger.getLogger(ClusterAlertAdapter.class); @Inject private AlertManager _alertMgr; @@ -46,8 +44,8 @@ public class ClusterAlertAdapter extends AdapterBase implements AlertAdapter { private ManagementServerHostDao _mshostDao; public void onClusterAlert(Object sender, EventArgs args) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Receive cluster alert, EventArgs: " + args.getClass().getName()); + if (logger.isDebugEnabled()) { + logger.debug("Receive cluster alert, EventArgs: " + args.getClass().getName()); } if (args instanceof ClusterNodeJoinEventArgs) { @@ -55,21 +53,21 @@ public class ClusterAlertAdapter extends AdapterBase implements AlertAdapter { } else if (args instanceof ClusterNodeLeftEventArgs) { onClusterNodeLeft(sender, (ClusterNodeLeftEventArgs)args); } else { - s_logger.error("Unrecognized cluster alert event"); + logger.error("Unrecognized cluster alert event"); } } private void onClusterNodeJoined(Object sender, ClusterNodeJoinEventArgs args) { - if (s_logger.isDebugEnabled()) { + if (logger.isDebugEnabled()) { for (ManagementServerHostVO mshost : args.getJoinedNodes()) { - s_logger.debug("Handle cluster node join alert, joined node: " + mshost.getServiceIP() + ", msidL: " + mshost.getMsid()); + logger.debug("Handle cluster node join alert, joined node: " + mshost.getServiceIP() + ", msidL: " + mshost.getMsid()); } } for (ManagementServerHostVO mshost : args.getJoinedNodes()) { if (mshost.getId() == args.getSelf().longValue()) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Management server node " + mshost.getServiceIP() + " is up, send alert"); + if (logger.isDebugEnabled()) { + logger.debug("Management server node " + mshost.getServiceIP() + " is up, send alert"); } _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_MANAGMENT_NODE, 0, new Long(0), "Management server node " + mshost.getServiceIP() + " is up", ""); @@ -80,23 +78,23 @@ public class ClusterAlertAdapter extends AdapterBase implements AlertAdapter { private void onClusterNodeLeft(Object sender, ClusterNodeLeftEventArgs args) { - if (s_logger.isDebugEnabled()) { + if (logger.isDebugEnabled()) { for (ManagementServerHostVO mshost : args.getLeftNodes()) { - s_logger.debug("Handle cluster node left alert, leaving node: " + mshost.getServiceIP() + ", msid: " + mshost.getMsid()); + logger.debug("Handle cluster node left alert, leaving node: " + mshost.getServiceIP() + ", msid: " + mshost.getMsid()); } } for (ManagementServerHostVO mshost : args.getLeftNodes()) { if (mshost.getId() != args.getSelf().longValue()) { if (_mshostDao.increaseAlertCount(mshost.getId()) > 0) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Detected management server node " + mshost.getServiceIP() + " is down, send alert"); + if (logger.isDebugEnabled()) { + logger.debug("Detected management server node " + mshost.getServiceIP() + " is down, send alert"); } _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_MANAGMENT_NODE, 0, new Long(0), "Management server node " + mshost.getServiceIP() + " is down", ""); } else { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Detected management server node " + mshost.getServiceIP() + " is down, but alert has already been set"); + if (logger.isDebugEnabled()) { + logger.debug("Detected management server node " + mshost.getServiceIP() + " is down, but alert has already been set"); } } } @@ -106,8 +104,8 @@ public class ClusterAlertAdapter extends AdapterBase implements AlertAdapter { @Override public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { - if (s_logger.isInfoEnabled()) { - s_logger.info("Start configuring cluster alert manager : " + name); + if (logger.isInfoEnabled()) { + logger.info("Start configuring cluster alert manager : " + name); } try { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java b/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java index ba1dca4..7962906 100644 --- a/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java +++ b/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java @@ -22,7 +22,6 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import com.cloud.consoleproxy.ConsoleProxyAlertEventArgs; @@ -39,7 +38,6 @@ import com.cloud.vm.dao.ConsoleProxyDao; @Local(value = AlertAdapter.class) public class ConsoleProxyAlertAdapter extends AdapterBase implements AlertAdapter { - private static final Logger s_logger = Logger.getLogger(ConsoleProxyAlertAdapter.class); @Inject private AlertManager _alertMgr; @@ -49,8 +47,8 @@ public class ConsoleProxyAlertAdapter extends AdapterBase implements AlertAdapte private ConsoleProxyDao _consoleProxyDao; public void onProxyAlert(Object sender, ConsoleProxyAlertEventArgs args) { - if (s_logger.isDebugEnabled()) - s_logger.debug("received console proxy alert"); + if (logger.isDebugEnabled()) + logger.debug("received console proxy alert"); DataCenterVO dc = _dcDao.findById(args.getZoneId()); ConsoleProxyVO proxy = args.getProxy(); @@ -64,14 +62,14 @@ public class ConsoleProxyAlertAdapter extends AdapterBase implements AlertAdapte switch (args.getType()) { case ConsoleProxyAlertEventArgs.PROXY_CREATED: - if (s_logger.isDebugEnabled()) - s_logger.debug("New console proxy created, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() + + if (logger.isDebugEnabled()) + logger.debug("New console proxy created, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() + ", private IP: " + proxy.getPrivateIpAddress()); break; case ConsoleProxyAlertEventArgs.PROXY_UP: - if (s_logger.isDebugEnabled()) - s_logger.debug("Console proxy is up, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() + + if (logger.isDebugEnabled()) + logger.debug("Console proxy is up, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() + ", private IP: " + proxy.getPrivateIpAddress()); _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(), proxy.getPodIdToDeployIn(), @@ -81,8 +79,8 @@ public class ConsoleProxyAlertAdapter extends AdapterBase implements AlertAdapte break; case ConsoleProxyAlertEventArgs.PROXY_DOWN: - if (s_logger.isDebugEnabled()) - s_logger.debug("Console proxy is down, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() + + if (logger.isDebugEnabled()) + logger.debug("Console proxy is down, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() + ", private IP: " + (proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress())); _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(), proxy.getPodIdToDeployIn(), @@ -92,8 +90,8 @@ public class ConsoleProxyAlertAdapter extends AdapterBase implements AlertAdapte break; case ConsoleProxyAlertEventArgs.PROXY_REBOOTED: - if (s_logger.isDebugEnabled()) - s_logger.debug("Console proxy is rebooted, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() + + if (logger.isDebugEnabled()) + logger.debug("Console proxy is rebooted, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() + ", private IP: " + (proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress())); _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(), proxy.getPodIdToDeployIn(), @@ -103,16 +101,16 @@ public class ConsoleProxyAlertAdapter extends AdapterBase implements AlertAdapte break; case ConsoleProxyAlertEventArgs.PROXY_CREATE_FAILURE: - if (s_logger.isDebugEnabled()) - s_logger.debug("Console proxy creation failure, zone: " + dc.getName()); + if (logger.isDebugEnabled()) + logger.debug("Console proxy creation failure, zone: " + dc.getName()); _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(), null, "Console proxy creation failure. zone: " + dc.getName() + ", error details: " + args.getMessage(), "Console proxy creation failure (zone " + dc.getName() + ")"); break; case ConsoleProxyAlertEventArgs.PROXY_START_FAILURE: - if (s_logger.isDebugEnabled()) - s_logger.debug("Console proxy startup failure, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + + if (logger.isDebugEnabled()) + logger.debug("Console proxy startup failure, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() + ", private IP: " + (proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress())); _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(), proxy.getPodIdToDeployIn(), @@ -122,8 +120,8 @@ public class ConsoleProxyAlertAdapter extends AdapterBase implements AlertAdapte break; case ConsoleProxyAlertEventArgs.PROXY_FIREWALL_ALERT: - if (s_logger.isDebugEnabled()) - s_logger.debug("Console proxy firewall alert, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + + if (logger.isDebugEnabled()) + logger.debug("Console proxy firewall alert, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() + ", private IP: " + (proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress())); _alertMgr.sendAlert( @@ -136,8 +134,8 @@ public class ConsoleProxyAlertAdapter extends AdapterBase implements AlertAdapte break; case ConsoleProxyAlertEventArgs.PROXY_STORAGE_ALERT: - if (s_logger.isDebugEnabled()) - s_logger.debug("Console proxy storage alert, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + + if (logger.isDebugEnabled()) + logger.debug("Console proxy storage alert, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() + ", private IP: " + proxy.getPrivateIpAddress() + ", message: " + args.getMessage()); _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_STORAGE_MISC, args.getZoneId(), proxy.getPodIdToDeployIn(), @@ -149,8 +147,8 @@ public class ConsoleProxyAlertAdapter extends AdapterBase implements AlertAdapte @Override public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { - if (s_logger.isInfoEnabled()) - s_logger.info("Start configuring console proxy alert manager : " + name); + if (logger.isInfoEnabled()) + logger.info("Start configuring console proxy alert manager : " + name); try { SubscriptionMgr.getInstance().subscribe(ConsoleProxyManager.ALERT_SUBJECT, this, "onProxyAlert"); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java b/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java index 392015b..eaf918f 100644 --- a/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java +++ b/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java @@ -22,7 +22,6 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import com.cloud.dc.DataCenterVO; @@ -39,7 +38,6 @@ import com.cloud.vm.dao.SecondaryStorageVmDao; @Local(value = AlertAdapter.class) public class SecondaryStorageVmAlertAdapter extends AdapterBase implements AlertAdapter { - private static final Logger s_logger = Logger.getLogger(SecondaryStorageVmAlertAdapter.class); @Inject private AlertManager _alertMgr; @@ -49,8 +47,8 @@ public class SecondaryStorageVmAlertAdapter extends AdapterBase implements Alert private SecondaryStorageVmDao _ssvmDao; public void onSSVMAlert(Object sender, SecStorageVmAlertEventArgs args) { - if (s_logger.isDebugEnabled()) - s_logger.debug("received secondary storage vm alert"); + if (logger.isDebugEnabled()) + logger.debug("received secondary storage vm alert"); DataCenterVO dc = _dcDao.findById(args.getZoneId()); SecondaryStorageVmVO secStorageVm = args.getSecStorageVm(); @@ -63,14 +61,14 @@ public class SecondaryStorageVmAlertAdapter extends AdapterBase implements Alert switch (args.getType()) { case SecStorageVmAlertEventArgs.SSVM_CREATED: - if (s_logger.isDebugEnabled()) - s_logger.debug("New secondary storage vm created, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + + if (logger.isDebugEnabled()) + logger.debug("New secondary storage vm created, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " + secStorageVm.getPrivateIpAddress()); break; case SecStorageVmAlertEventArgs.SSVM_UP: - if (s_logger.isDebugEnabled()) - s_logger.debug("Secondary Storage Vm is up, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + + if (logger.isDebugEnabled()) + logger.debug("Secondary Storage Vm is up, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " + secStorageVm.getPrivateIpAddress()); _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(), secStorageVm.getPodIdToDeployIn(), "Secondary Storage Vm up in zone: " + @@ -79,8 +77,8 @@ public class SecondaryStorageVmAlertAdapter extends AdapterBase implements Alert break; case SecStorageVmAlertEventArgs.SSVM_DOWN: - if (s_logger.isDebugEnabled()) - s_logger.debug("Secondary Storage Vm is down, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + + if (logger.isDebugEnabled()) + logger.debug("Secondary Storage Vm is down, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress())); _alertMgr.sendAlert( @@ -93,8 +91,8 @@ public class SecondaryStorageVmAlertAdapter extends AdapterBase implements Alert break; case SecStorageVmAlertEventArgs.SSVM_REBOOTED: - if (s_logger.isDebugEnabled()) - s_logger.debug("Secondary Storage Vm is rebooted, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + + if (logger.isDebugEnabled()) + logger.debug("Secondary Storage Vm is rebooted, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress())); _alertMgr.sendAlert( @@ -107,8 +105,8 @@ public class SecondaryStorageVmAlertAdapter extends AdapterBase implements Alert break; case SecStorageVmAlertEventArgs.SSVM_CREATE_FAILURE: - if (s_logger.isDebugEnabled()) - s_logger.debug("Secondary Storage Vm creation failure, zone: " + dc.getName()); + if (logger.isDebugEnabled()) + logger.debug("Secondary Storage Vm creation failure, zone: " + dc.getName()); _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(), null, "Secondary Storage Vm creation failure. zone: " + dc.getName() + ", error details: " + args.getMessage(), @@ -116,8 +114,8 @@ public class SecondaryStorageVmAlertAdapter extends AdapterBase implements Alert break; case SecStorageVmAlertEventArgs.SSVM_START_FAILURE: - if (s_logger.isDebugEnabled()) - s_logger.debug("Secondary Storage Vm startup failure, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + + if (logger.isDebugEnabled()) + logger.debug("Secondary Storage Vm startup failure, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress())); _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(), secStorageVm.getPodIdToDeployIn(), @@ -128,8 +126,8 @@ public class SecondaryStorageVmAlertAdapter extends AdapterBase implements Alert break; case SecStorageVmAlertEventArgs.SSVM_FIREWALL_ALERT: - if (s_logger.isDebugEnabled()) - s_logger.debug("Secondary Storage Vm firewall alert, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + + if (logger.isDebugEnabled()) + logger.debug("Secondary Storage Vm firewall alert, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress())); _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(), secStorageVm.getPodIdToDeployIn(), @@ -139,8 +137,8 @@ public class SecondaryStorageVmAlertAdapter extends AdapterBase implements Alert break; case SecStorageVmAlertEventArgs.SSVM_STORAGE_ALERT: - if (s_logger.isDebugEnabled()) - s_logger.debug("Secondary Storage Vm storage alert, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + + if (logger.isDebugEnabled()) + logger.debug("Secondary Storage Vm storage alert, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " + secStorageVm.getPrivateIpAddress() + ", message: " + args.getMessage()); _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_STORAGE_MISC, args.getZoneId(), secStorageVm.getPodIdToDeployIn(), @@ -153,8 +151,8 @@ public class SecondaryStorageVmAlertAdapter extends AdapterBase implements Alert @Override public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { - if (s_logger.isInfoEnabled()) - s_logger.info("Start configuring secondary storage vm alert manager : " + name); + if (logger.isInfoEnabled()) + logger.info("Start configuring secondary storage vm alert manager : " + name); try { SubscriptionMgr.getInstance().subscribe(SecondaryStorageVmManager.ALERT_SUBJECT, this, "onSSVMAlert"); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3818257a/server/src/com/cloud/api/ApiAsyncJobDispatcher.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/ApiAsyncJobDispatcher.java b/server/src/com/cloud/api/ApiAsyncJobDispatcher.java index 0b7d681..c925e1a 100644 --- a/server/src/com/cloud/api/ApiAsyncJobDispatcher.java +++ b/server/src/com/cloud/api/ApiAsyncJobDispatcher.java @@ -21,7 +21,6 @@ import java.util.Map; import javax.inject.Inject; -import org.apache.log4j.Logger; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; @@ -45,7 +44,6 @@ import com.cloud.utils.component.ComponentContext; import com.cloud.utils.db.EntityManager; public class ApiAsyncJobDispatcher extends AdapterBase implements AsyncJobDispatcher { - private static final Logger s_logger = Logger.getLogger(ApiAsyncJobDispatcher.class); @Inject private ApiDispatcher _dispatcher; @@ -118,7 +116,7 @@ public class ApiAsyncJobDispatcher extends AdapterBase implements AsyncJobDispat String errorMsg = null; int errorCode = ApiErrorCode.INTERNAL_ERROR.getHttpCode(); if (!(e instanceof ServerApiException)) { - s_logger.error("Unexpected exception while executing " + job.getCmd(), e); + logger.error("Unexpected exception while executing " + job.getCmd(), e); errorMsg = e.getMessage(); } else { ServerApiException sApiEx = (ServerApiException)e;
