Skip to content

Commit

Permalink
remove string.format from logger.trace statements
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexjsenn committed Dec 18, 2020
1 parent e473464 commit 7ed65f8
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static void main(String[] args) throws Exception {
final Logger logger = Logger.INSTANCE;
final Environment environment = new Environment();

logger.trace(String.format("env: %s", environment.getEnv().toString()));
logger.trace("env: {}", environment.getEnv().toString());

logger.info("{} started.", System.getProperty("java.rmi.server.hostname", "container-jfr"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ class SslConfiguration {
strategy = new KeyCertStrategy(key, cert);
logger.info(
"Selected SSL KeyCert strategy with key {} and cert {}",
key.toString(), cert.toString());
key.toString(),
cert.toString());
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private JFRConnection attemptConnectAsHostPortPair(ConnectionDescriptor connecti

private JFRConnection connect(JMXServiceURL url, Optional<Credentials> credentials)
throws Exception {
logger.trace(String.format("Locking connection %s", url.toString()));
logger.trace("Locking connection {}", url.toString());
lock.lockInterruptibly();
return jfrConnectionToolkit
.get()
Expand All @@ -141,11 +141,7 @@ private JFRConnection connect(JMXServiceURL url, Optional<Credentials> credentia
credentials.orElse(null),
List.of(
lock::unlock,
() ->
logger.trace(
String.format(
"Unlocking connection %s",
url.toString()))));
() -> logger.trace("Unlocking connection {}", url.toString())));
}

public interface ConnectedTask<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ boolean delete(ConnectionDescriptor connectionDescriptor, String recordingName)
RecordingDescriptor key = new RecordingDescriptor(connectionDescriptor, recordingName);
boolean hasKey = cache.asMap().containsKey(key);
if (hasKey) {
logger.trace(String.format("Invalidated active report cache for %s", recordingName));
logger.trace("Invalidated active report cache for {}", recordingName);
cache.invalidate(key);
} else {
logger.trace(String.format("No cache entry for %s to invalidate", recordingName));
logger.trace("No cache entry for {} to invalidate", recordingName);
}
return hasKey;
}
Expand All @@ -128,9 +128,7 @@ protected String getReport(RecordingDescriptor recordingDescriptor) throws Excep
Path saveFile = null;
try {
generationLock.lock();
logger.trace(
String.format(
"Active report cache miss for %s", recordingDescriptor.recordingName));
logger.trace("Active report cache miss for {}", recordingDescriptor.recordingName);
try {
saveFile =
subprocessReportGeneratorProvider
Expand Down Expand Up @@ -163,7 +161,7 @@ protected String getReport(RecordingDescriptor recordingDescriptor) throws Excep
.findFirst();
if (clone.isPresent()) {
conn.getService().close(clone.get());
logger.trace("Cleaned dangling recording " + cloneName);
logger.trace("Cleaned dangling recording {}", cloneName);
}
return null;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,7 @@ Future<Path> get(String recordingName) {
.findFirst()
.ifPresentOrElse(
recording -> {
logger.trace(
String.format(
"Archived report cache miss for %s",
recordingName));
logger.trace("Archived report cache miss for {}", recordingName);
try {
Path saveFile =
subprocessReportGeneratorProvider
Expand Down Expand Up @@ -143,7 +140,7 @@ Future<Path> get(String recordingName) {

boolean delete(String recordingName) {
try {
logger.trace(String.format("Invalidating archived report cache for %s", recordingName));
logger.trace("Invalidating archived report cache for {}", recordingName);
return fs.deleteIfExists(getCachedReportPath(recordingName));
} catch (IOException ioe) {
logger.warn(ioe);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,7 @@ public void start() throws FlightRecorderException, SocketException, UnknownHost
}
route = route.failureHandler(failureHandler);
if (!handler.isAvailable()) {
logger.trace(
String.format(
"%s handler disabled", handler.getClass().getSimpleName()));
logger.trace("{} handler disabled", handler.getClass().getSimpleName());
route = route.disable();
}
});
Expand Down

0 comments on commit 7ed65f8

Please sign in to comment.