Cleanup: Standardize logger message formatting in ApiServer.java (#11188)

This commit is contained in:
Suyang(Dawson) Chen 2026-01-09 03:30:17 -05:00 committed by GitHub
parent 1ef6365771
commit 1b861dad48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 8 deletions

View File

@ -461,14 +461,14 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
final Long snapshotLimit = ConcurrentSnapshotsThresholdPerHost.value();
if (snapshotLimit == null || snapshotLimit <= 0) {
logger.debug("Global concurrent snapshot config parameter " + ConcurrentSnapshotsThresholdPerHost.value() + " is less or equal 0; defaulting to unlimited");
logger.debug("Global concurrent snapshot config parameter {} is less or equal 0; defaulting to unlimited", ConcurrentSnapshotsThresholdPerHost.value());
} else {
dispatcher.setCreateSnapshotQueueSizeLimit(snapshotLimit);
}
final Long migrationLimit = VolumeApiService.ConcurrentMigrationsThresholdPerDatastore.value();
if (migrationLimit == null || migrationLimit <= 0) {
logger.debug("Global concurrent migration config parameter " + VolumeApiService.ConcurrentMigrationsThresholdPerDatastore.value() + " is less or equal 0; defaulting to unlimited");
logger.debug("Global concurrent migration config parameter {} is less or equal 0; defaulting to unlimited", VolumeApiService.ConcurrentMigrationsThresholdPerDatastore.value());
} else {
dispatcher.setMigrateQueueSizeLimit(migrationLimit);
}
@ -647,7 +647,7 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
logValue = (value == null) ? "'null'" : value[0];
}
logger.trace(" key: " + keyStr + ", value: " + logValue);
logger.trace(" key: {}, value: {}", keyStr, logValue);
}
}
throw new ServerApiException(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, "Invalid request, no command sent");
@ -707,7 +707,7 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
buf.append(obj.getUuid());
buf.append(" ");
}
logger.info("PermissionDenied: " + ex.getMessage() + " on objs: [" + buf + "]");
logger.info("PermissionDenied: {} on objs: [{}]", ex.getMessage(), buf);
} else {
logger.info("PermissionDenied: {}", ex.getMessage());
}
@ -1035,7 +1035,7 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
// if api/secret key are passed to the parameters
if ((signature == null) || (apiKey == null)) {
logger.debug("Expired session, missing signature, or missing apiKey -- ignoring request. Signature: " + signature + ", apiKey: " + apiKey);
logger.warn("Expired session, missing signature, or missing apiKey -- ignoring request. Signature: {}, apiKey: {}", signature, apiKey);
return false; // no signature, bad request
}
@ -1258,7 +1258,7 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
float offsetInHrs = 0f;
if (timezone != null) {
final TimeZone t = TimeZone.getTimeZone(timezone);
logger.info("Current user logged in under " + timezone + " timezone");
logger.info("Current user logged in under {} timezone", timezone);
final java.util.Date date = new java.util.Date();
final long longDate = date.getTime();
@ -1410,9 +1410,9 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
final Boolean apiSourceCidrChecksEnabled = ApiServiceConfiguration.ApiSourceCidrChecksEnabled.value();
if (apiSourceCidrChecksEnabled) {
logger.debug("CIDRs from which account '" + account.toString() + "' is allowed to perform API calls: " + accessAllowedCidrs);
logger.debug("CIDRs from which account '{}' is allowed to perform API calls: {}", account.toString(), accessAllowedCidrs);
if (!NetUtils.isIpInCidrList(remoteAddress, accessAllowedCidrs.split(","))) {
logger.warn("Request by account '" + account.toString() + "' was denied since " + remoteAddress + " does not match " + accessAllowedCidrs);
logger.warn("Request by account '{}' was denied since {} does not match {}", account.toString(), remoteAddress, accessAllowedCidrs);
throw new OriginDeniedException("Calls from disallowed origin", account, remoteAddress);
}
}