Skip to content

Commit 27aef97

Browse files
committed
keep ApiServer log consistent
1 parent 5b7c3b4 commit 27aef97

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

server/src/main/java/com/cloud/api/ApiServer.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -444,14 +444,14 @@ public boolean start() {
444444

445445
final Long snapshotLimit = ConcurrentSnapshotsThresholdPerHost.value();
446446
if (snapshotLimit == null || snapshotLimit <= 0) {
447-
logger.debug("Global concurrent snapshot config parameter " + ConcurrentSnapshotsThresholdPerHost.value() + " is less or equal 0; defaulting to unlimited");
447+
logger.debug("Global concurrent snapshot config parameter {} is less or equal 0; defaulting to unlimited", ConcurrentSnapshotsThresholdPerHost.value());
448448
} else {
449449
dispatcher.setCreateSnapshotQueueSizeLimit(snapshotLimit);
450450
}
451451

452452
final Long migrationLimit = VolumeApiService.ConcurrentMigrationsThresholdPerDatastore.value();
453453
if (migrationLimit == null || migrationLimit <= 0) {
454-
logger.debug("Global concurrent migration config parameter " + VolumeApiService.ConcurrentMigrationsThresholdPerDatastore.value() + " is less or equal 0; defaulting to unlimited");
454+
logger.debug("Global concurrent migration config parameter {} is less or equal 0; defaulting to unlimited", VolumeApiService.ConcurrentMigrationsThresholdPerDatastore.value());
455455
} else {
456456
dispatcher.setMigrateQueueSizeLimit(migrationLimit);
457457
}
@@ -617,7 +617,7 @@ public String handleRequest(final Map params, final String responseType, final S
617617
for (final Object key : params.keySet()) {
618618
final String keyStr = (String)key;
619619
final String[] value = (String[])params.get(key);
620-
logger.trace(" key: " + keyStr + ", value: " + ((value == null) ? "'null'" : value[0]));
620+
logger.trace(" key: {}, value: {}", keyStr, (value == null) ? "'null'" : value[0]);
621621
}
622622
}
623623
throw new ServerApiException(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, "Invalid request, no command sent");
@@ -677,7 +677,7 @@ public String handleRequest(final Map params, final String responseType, final S
677677
buf.append(obj.getUuid());
678678
buf.append(" ");
679679
}
680-
logger.info("PermissionDenied: " + ex.getMessage() + " on objs: [" + buf + "]");
680+
logger.info("PermissionDenied: {} on objs: [{}]", ex.getMessage(), buf);
681681
} else {
682682
logger.info("PermissionDenied: {}", ex.getMessage());
683683
}
@@ -998,7 +998,7 @@ public boolean verifyRequest(final Map<String, Object[]> requestParameters, fina
998998

999999
// if api/secret key are passed to the parameters
10001000
if ((signature == null) || (apiKey == null)) {
1001-
logger.debug("Expired session, missing signature, or missing apiKey -- ignoring request. Signature: " + signature + ", apiKey: " + apiKey);
1001+
logger.debug("Expired session, missing signature, or missing apiKey -- ignoring request. Signature: {}, apiKey: {}", signature, apiKey);
10021002
return false; // no signature, bad request
10031003
}
10041004

@@ -1211,7 +1211,7 @@ public ResponseObject loginUser(final HttpSession session, final String username
12111211
float offsetInHrs = 0f;
12121212
if (timezone != null) {
12131213
final TimeZone t = TimeZone.getTimeZone(timezone);
1214-
logger.info("Current user logged in under " + timezone + " timezone");
1214+
logger.info("Current user logged in under {} timezone", timezone);
12151215

12161216
final java.util.Date date = new java.util.Date();
12171217
final long longDate = date.getTime();
@@ -1363,9 +1363,9 @@ private void checkCommandAvailable(final User user, final String commandName, fi
13631363
final Boolean apiSourceCidrChecksEnabled = ApiServiceConfiguration.ApiSourceCidrChecksEnabled.value();
13641364

13651365
if (apiSourceCidrChecksEnabled) {
1366-
logger.debug("CIDRs from which account '" + account.toString() + "' is allowed to perform API calls: " + accessAllowedCidrs);
1366+
logger.debug("CIDRs from which account '{}' is allowed to perform API calls: {}", account.toString(), accessAllowedCidrs);
13671367
if (!NetUtils.isIpInCidrList(remoteAddress, accessAllowedCidrs.split(","))) {
1368-
logger.warn("Request by account '" + account.toString() + "' was denied since " + remoteAddress + " does not match " + accessAllowedCidrs);
1368+
logger.warn("Request by account '{}' was denied since {} does not match {}", account.toString(), remoteAddress, accessAllowedCidrs);
13691369
throw new OriginDeniedException("Calls from disallowed origin", account, remoteAddress);
13701370
}
13711371
}

0 commit comments

Comments
 (0)