diff --git a/plugins/metrics/src/main/java/org/apache/cloudstack/metrics/MetricsServiceImpl.java b/plugins/metrics/src/main/java/org/apache/cloudstack/metrics/MetricsServiceImpl.java index 320660417dc..0a6e6e8f4fd 100644 --- a/plugins/metrics/src/main/java/org/apache/cloudstack/metrics/MetricsServiceImpl.java +++ b/plugins/metrics/src/main/java/org/apache/cloudstack/metrics/MetricsServiceImpl.java @@ -789,7 +789,7 @@ public class MetricsServiceImpl extends MutualExclusiveIdsManagerBase implements Double imbalance = ClusterDrsAlgorithm.getClusterImbalance(clusterId, cpuList, memoryList, null); metricsResponse.setDrsImbalance(imbalance.isNaN() ? null : 100.0 * imbalance); } catch (ConfigurationException e) { - LOGGER.warn("Failed to get cluster imbalance for cluster " + clusterId, e); + logger.warn("Failed to get cluster imbalance for cluster " + clusterId, e); } metricsResponse.setState(clusterResponse.getAllocationState(), clusterResponse.getManagedState()); diff --git a/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStoragePool.java b/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStoragePool.java index 4077d5dadfd..2d6801049a3 100644 --- a/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStoragePool.java +++ b/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStoragePool.java @@ -34,11 +34,12 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.JsonSyntaxException; import org.apache.cloudstack.utils.qemu.QemuImg; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.joda.time.Duration; public class LinstorStoragePool implements KVMStoragePool { - private static final Logger s_logger = Logger.getLogger(LinstorStoragePool.class); + private static final Logger LOGGER = LogManager.getLogger(LinstorStoragePool.class); private final String _uuid; private final String _sourceHost; private final int _sourcePort; @@ -226,12 +227,12 @@ public class LinstorStoragePool implements KVMStoragePool { @Override public String createHeartBeatCommand(HAStoragePool pool, String hostPrivateIp, boolean hostValidation) { - s_logger.trace(String.format("Linstor.createHeartBeatCommand: %s, %s, %b", pool.getPoolIp(), hostPrivateIp, hostValidation)); + LOGGER.trace(String.format("Linstor.createHeartBeatCommand: %s, %s, %b", pool.getPoolIp(), hostPrivateIp, hostValidation)); boolean isStorageNodeUp = checkingHeartBeat(pool, null); if (!isStorageNodeUp && !hostValidation) { //restart the host - s_logger.debug(String.format("The host [%s] will be restarted because the health check failed for the storage pool [%s]", hostPrivateIp, pool.getPool().getType())); - Script cmd = new Script(pool.getPool().getHearthBeatPath(), Duration.millis(HeartBeatUpdateTimeout), s_logger); + LOGGER.debug(String.format("The host [%s] will be restarted because the health check failed for the storage pool [%s]", hostPrivateIp, pool.getPool().getType())); + Script cmd = new Script(pool.getPool().getHearthBeatPath(), Duration.millis(HeartBeatUpdateTimeout), LOGGER); cmd.add("-c"); cmd.execute(); return "Down"; @@ -247,7 +248,7 @@ public class LinstorStoragePool implements KVMStoragePool { static String getHostname() { OutputInterpreter.AllLinesParser parser = new OutputInterpreter.AllLinesParser(); - Script sc = new Script("hostname", Duration.millis(10000L), s_logger); + Script sc = new Script("hostname", Duration.millis(10000L), LOGGER); String res = sc.execute(parser); if (res != null) { throw new CloudRuntimeException(String.format("Unable to run 'hostname' command: %s", res)); @@ -264,7 +265,7 @@ public class LinstorStoragePool implements KVMStoragePool { } else { hostName = host.getParent(); if (hostName == null) { - s_logger.error("No hostname set in host.getParent()"); + LOGGER.error("No hostname set in host.getParent()"); return false; } } @@ -273,7 +274,7 @@ public class LinstorStoragePool implements KVMStoragePool { } private String executeDrbdSetupStatus(OutputInterpreter.AllLinesParser parser) { - Script sc = new Script("drbdsetup", Duration.millis(HeartBeatUpdateTimeout), s_logger); + Script sc = new Script("drbdsetup", Duration.millis(HeartBeatUpdateTimeout), LOGGER); sc.add("status"); sc.add("--json"); return sc.execute(parser); @@ -293,12 +294,12 @@ public class LinstorStoragePool implements KVMStoragePool { } } } - s_logger.warn(String.format("checkDrbdSetupStatusOutput: no resource connected to %s.", otherNodeName)); + LOGGER.warn(String.format("checkDrbdSetupStatusOutput: no resource connected to %s.", otherNodeName)); return false; } private String executeDrbdEventsNow(OutputInterpreter.AllLinesParser parser) { - Script sc = new Script("drbdsetup", Duration.millis(HeartBeatUpdateTimeout), s_logger); + Script sc = new Script("drbdsetup", Duration.millis(HeartBeatUpdateTimeout), LOGGER); sc.add("events2"); sc.add("--now"); return sc.execute(parser); @@ -307,13 +308,13 @@ public class LinstorStoragePool implements KVMStoragePool { private boolean checkDrbdEventsNowOutput(String output) { boolean healthy = output.lines().noneMatch(line -> line.matches(".*role:Primary .* promotion_score:0.*")); if (!healthy) { - s_logger.warn("checkDrbdEventsNowOutput: primary resource with promotion score==0; HA false"); + LOGGER.warn("checkDrbdEventsNowOutput: primary resource with promotion score==0; HA false"); } return healthy; } private boolean checkHostUpToDateAndConnected(String hostName) { - s_logger.trace(String.format("checkHostUpToDateAndConnected: %s/%s", localNodeName, hostName)); + LOGGER.trace(String.format("checkHostUpToDateAndConnected: %s/%s", localNodeName, hostName)); OutputInterpreter.AllLinesParser parser = new OutputInterpreter.AllLinesParser(); if (localNodeName.equalsIgnoreCase(hostName)) { @@ -331,7 +332,7 @@ public class LinstorStoragePool implements KVMStoragePool { try { return checkDrbdSetupStatusOutput(parser.getLines(), hostName); } catch (JsonIOException | JsonSyntaxException e) { - s_logger.error("Error parsing drbdsetup status --json", e); + LOGGER.error("Error parsing drbdsetup status --json", e); } } return false; @@ -339,7 +340,7 @@ public class LinstorStoragePool implements KVMStoragePool { @Override public Boolean vmActivityCheck(HAStoragePool pool, HostTO host, Duration activityScriptTimeout, String volumeUUIDListString, String vmActivityCheckPath, long duration) { - s_logger.trace(String.format("Linstor.vmActivityCheck: %s, %s", pool.getPoolIp(), host.getPrivateNetwork().getIp())); + LOGGER.trace(String.format("Linstor.vmActivityCheck: %s, %s", pool.getPoolIp(), host.getPrivateNetwork().getIp())); return checkingHeartBeat(pool, host); } } diff --git a/server/src/main/java/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java b/server/src/main/java/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java index a46c2fd81ea..c09df8d8655 100644 --- a/server/src/main/java/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java +++ b/server/src/main/java/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java @@ -305,9 +305,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian List vpcIps = _ipAddressDao.listByAssociatedVpc(router.getVpcId(), true); if (CollectionUtils.isNotEmpty(vpcIps)) { buf.append(String.format(" source_nat_ip=%s", vpcIps.get(0).getAddress().toString())); - if (s_logger.isDebugEnabled()) { - s_logger.debug("The final Boot Args for " + profile + ": " + buf); - } + logger.debug("The final Boot Args for " + profile + ": " + buf); } } }