sureshanaparti commented on a change in pull request #5353:
URL: https://github.com/apache/cloudstack/pull/5353#discussion_r704082254
##########
File path:
plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
##########
@@ -1774,9 +1768,7 @@ private void ensureScsiDiskControllers(VirtualMachineMO
vmMo, String scsiDiskCon
}
protected StartAnswer execute(StartCommand cmd) {
- if (s_logger.isInfoEnabled()) {
- s_logger.info("Executing resource StartCommand: " +
getHumanReadableBytesJson(_gson.toJson(cmd)));
- }
+ s_logger.debug(String.format(EXECUTING_RESOURCE_COMMAND,
cmd.getClass().getSimpleName(), _gson.toJson(cmd)));
Review comment:
@SadiJr Better to move the string constant with its attributes (
`String.format(EXECUTING_RESOURCE_COMMAND, cmd.getClass().getSimpleName(),
_gson.toJson(cmd))` ) to a private method, so that the no. of format specifiers
'%s' in the string are in sync with the attributes passed.
Otherwise, add a utility method in Command class, that returns class name
with its attributes, and define a private method here for the log. For ex:
```
private getResourceCmdLog(Command cmd) {
return String.format("Executing resource command: %s.",
cmd.getClassNameWithAttributes());
}
```
Command class:
```
getClassNameWithAttributes(Command cmd) {
return String.format("%s: [%s]", getClass().getSimpleName(),
_gson.toJson(this));
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]