Skip to content

Commit

Permalink
Finish removing all string.format inside logger calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexjsenn committed Dec 18, 2020
1 parent b698237 commit 86f8ef9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
11 changes: 5 additions & 6 deletions src/main/java/com/redhat/rhjmc/containerjfr/net/HttpServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,11 @@ public void start() throws SocketException, UnknownHostException {
future.join(); // wait for async deployment to complete

logger.info(
String.format(
"%s service running on %s://%s:%d",
isSsl() ? "HTTPS" : "HTTP",
isSsl() ? "https" : "http",
netConf.getWebServerHost(),
netConf.getExternalWebServerPort()));
"{} service running on {}://{}:{}",
isSsl() ? "HTTPS" : "HTTP",
isSsl() ? "https" : "http",
netConf.getWebServerHost(),
netConf.getExternalWebServerPort());
this.isAlive = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,9 @@ public static void main(String[] args) {
() -> {
long elapsedTime = System.nanoTime() - startTime;
Logger.INSTANCE.info(
String.format(
"%s shutting down after %dms",
SubprocessReportGenerator.class.getName(),
TimeUnit.NANOSECONDS.toMillis(elapsedTime)));
"{} shutting down after {}ms",
SubprocessReportGenerator.class.getName(),
TimeUnit.NANOSECONDS.toMillis(elapsedTime));
}));

var fs = new FileSystem();
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/com/redhat/rhjmc/containerjfr/net/web/WebServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,10 @@ public void start() throws FlightRecorderException, SocketException, UnknownHost
requestHandlers.forEach(
handler -> {
logger.trace(
String.format(
"Registering request handler (priority %d) for [%s]\t%s",
handler.getPriority(), handler.httpMethod(), handler.path()));
"Registering request handler (priority {}) for [{}]\t{}",
handler.getPriority(),
handler.httpMethod(),
handler.path());
Route route;
if (RequestHandler.ALL_PATHS.equals(handler.path())) {
route = router.route();
Expand All @@ -207,14 +208,13 @@ public void start() throws FlightRecorderException, SocketException, UnknownHost
.endHandler(
(res) ->
logger.info(
String.format(
"(%s): %s %s %d %dms",
req.remoteAddress().toString(),
req.method().toString(),
req.path(),
req.response().getStatusCode(),
Duration.between(start, Instant.now())
.toMillis())));
"({}): {} {} {} {}ms",
req.remoteAddress().toString(),
req.method().toString(),
req.path(),
req.response().getStatusCode(),
Duration.between(start, Instant.now())
.toMillis()));
router.handle(req);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ private void checkUri(String envName, String path, CompletableFuture<Boolean> fu
future.complete(false);
return;
}
logger.debug(
String.format("Testing health of %s=%s %s", envName, uri.toString(), path));
logger.debug("Testing health of {}={} {}", envName, uri.toString(), path);
HttpRequest<Buffer> req = webClient.get(uri.getHost(), path);
if (uri.getPort() != -1) {
req = req.port(uri.getPort());
Expand Down

0 comments on commit 86f8ef9

Please sign in to comment.