Skip to content

Commit 3436b44

Browse files
Fixed missing logging placeholders. (#10439)
1 parent 569b4a9 commit 3436b44

File tree

14 files changed

+36
-45
lines changed

14 files changed

+36
-45
lines changed

dd-java-agent/agent-crashtracking/src/main/java/datadog/crashtracking/Initializer.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,8 @@ public static boolean initialize(boolean forceJmx) {
8585
if (reasonNotLoaded != null) {
8686
LOG.debug(
8787
SEND_TELEMETRY,
88-
"Failed to load JVM access library: "
89-
+ jvmAccessHolder.getReasonNotLoaded().getMessage()
90-
+ ". Crash tracking will need to rely on user provided JVM arguments.");
88+
"Failed to load JVM access library: {}. Crash tracking will need to rely on user provided JVM arguments.",
89+
jvmAccessHolder.getReasonNotLoaded().getMessage());
9190
return false;
9291
} else {
9392
JVMAccess.Flags flags = jvmAccessHolder.getComponent().flags();
@@ -230,7 +229,8 @@ private static void initializeCrashUploader(FlagAccess flags) {
230229
if (!rslt && LOG.isDebugEnabled()) {
231230
LOG.debug(
232231
SEND_TELEMETRY,
233-
"Unable to set OnError flag to " + onErrorVal + ". Crash-tracking may not work.");
232+
"Unable to set OnError flag to {}. Crash-tracking may not work.",
233+
onErrorVal);
234234
}
235235

236236
CrashUploaderScriptInitializer.initialize(uploadScript, onErrorFile);
@@ -269,9 +269,8 @@ private static void initializeOOMENotifier(FlagAccess flags) {
269269
if (!rslt && LOG.isDebugEnabled()) {
270270
LOG.debug(
271271
SEND_TELEMETRY,
272-
"Unable to set OnOutOfMemoryError flag to "
273-
+ onOutOfMemoryVal
274-
+ ". OOME tracking may not work.");
272+
"Unable to set OnOutOfMemoryError flag to {}. OOME tracking may not work.",
273+
onOutOfMemoryVal);
275274
}
276275

277276
OOMENotifierScriptInitializer.initialize(notifierScript);
@@ -298,7 +297,8 @@ private static void logInitializationError(String msg, Throwable t) {
298297
} else {
299298
LOG.warn(
300299
SEND_TELEMETRY,
301-
msg + " [{}] (Change the logging level to debug to see the full stacktrace)",
300+
"{} [{}] (Change the logging level to debug to see the full stacktrace)",
301+
msg,
302302
t.getMessage());
303303
}
304304
}

dd-java-agent/agent-llmobs/src/main/java/datadog/trace/llmobs/EvalProcessingWorker.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ public void run() {
139139
Thread.currentThread().interrupt();
140140
}
141141
log.debug(
142-
"eval processor worker exited. submitting evals stopped. unsubmitted evals left: "
143-
+ !queuesAreEmpty());
142+
"eval processor worker exited. submitting evals stopped. unsubmitted evals left: {}",
143+
!queuesAreEmpty());
144144
}
145145

146146
private void runDutyCycle() throws InterruptedException {

dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/HelperInjector.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,8 @@ public DynamicType.Builder<?> transform(
159159
if (log.isErrorEnabled()) {
160160
// requestingName is concatenated to ensure it is sent to telemetry
161161
log.error(
162-
"Failed to inject helper classes - instrumentation.class="
163-
+ requestingName
164-
+ " instrumentation.target.classloader={} instrumentation.target.class={}",
162+
"Failed to inject helper classes - instrumentation.class={} instrumentation.target.classloader={} instrumentation.target.class={}",
163+
requestingName,
165164
classLoader,
166165
typeDescription,
167166
e);

dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/usm/UsmExtractorImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ public void send(UsmMessage message) {
2323
if (message.validate()) {
2424
BaseUsmMessage bm = (BaseUsmMessage) message;
2525

26-
log.debug(" sending ioctl: " + String.format("%08x", UsmMessageImpl.USM_IOCTL_ID.intValue()));
26+
log.debug(
27+
" sending ioctl: {}", String.format("%08x", UsmMessageImpl.USM_IOCTL_ID.intValue()));
2728
NativeLong res =
2829
CLibrary.Instance.ioctl(
2930
new NativeLong(0),

dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/usm/UsmMessageImpl.java

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ public final Pointer getBufferPtr() {
4848
@Override
4949
public boolean validate() {
5050
if (offset > getMessageSize()) {
51-
log.warn(
52-
String.format(
53-
"invalid message size, expected: %d actual: %d", getMessageSize(), offset));
51+
log.warn("invalid message size, expected: {} actual: {}", getMessageSize(), offset);
5452
return false;
5553
}
5654
return true;
@@ -158,17 +156,9 @@ public RequestUsmMessage(UsmConnection connection, byte[] buffer, int bufferOffs
158156
super(MessageType.REQUEST, connection);
159157

160158
log.debug("Request packet:");
161-
log.debug(
162-
"src host: "
163-
+ connection.getSrcIP().toString()
164-
+ " src port: "
165-
+ connection.getSrcPort());
166-
log.debug(
167-
"dst host: "
168-
+ connection.getDstIP().toString()
169-
+ " dst port: "
170-
+ connection.getDstPort());
171-
log.debug("intercepted byte len: " + len);
159+
log.debug("src host: {} src port: {}", connection.getSrcIP(), connection.getSrcPort());
160+
log.debug("dst host: {} dst port: {}", connection.getDstIP(), connection.getDstPort());
161+
log.debug("intercepted byte len: {}", len);
172162

173163
// check the buffer is not larger than max allowed,
174164
if (len - bufferOffset <= MAX_HTTPS_BUFFER_SIZE) {

dd-java-agent/agent-tooling/src/test/java/datadog/trace/agent/tooling/csi/StringConcatCategory2Example.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ public class StringConcatCategory2Example implements BiFunction<String, String,
99
private static final Logger LOGGER = LoggerFactory.getLogger(StringConcatCategory2Example.class);
1010

1111
public String apply(final String first, final String second) {
12-
LOGGER.debug("Before apply : " + (System.currentTimeMillis() / 1000L));
12+
LOGGER.debug("Before apply : {}", System.currentTimeMillis() / 1000L);
1313
final String result = first.concat(second);
14-
LOGGER.debug("After apply : " + (System.currentTimeMillis() / 1000L));
14+
LOGGER.debug("After apply : {}", System.currentTimeMillis() / 1000L);
1515
return result;
1616
}
1717
}

dd-java-agent/instrumentation/jetty/jetty-common/src/main/java/datadog/trace/instrumentation/jetty/JettyBlockingHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public class JettyBlockingHelper {
7777
isAsyncStartedMH =
7878
lookup().findVirtual(Request.class, "isAsyncStarted", methodType(boolean.class));
7979
} catch (NoSuchMethodException | IllegalAccessException e) {
80-
log.debug("Could not find " + Request.class.getName() + "#isAsyncStarted()");
80+
log.debug("Could not find {}#isAsyncStarted()", Request.class.getName());
8181

8282
try {
8383
Class<?> asyncContinuationCls =

dd-java-agent/instrumentation/maven/maven-3.2.1/src/test/java/datadog/trace/instrumentation/maven3/MavenProjectConfiguratorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ public void testTracerInjection(String pomPath, String goal, String[] additional
7777
assertTrue(argLinePreserved, "Original argLine was not preserved");
7878

7979
} catch (Exception | Error e) {
80-
LOGGER.info("Build output:\n\n" + stdOutBaos);
81-
LOGGER.info("Build error:\n\n" + stdErrBaos);
80+
LOGGER.info("Build output:\n\n{}", stdOutBaos);
81+
LOGGER.info("Build error:\n\n{}", stdErrBaos);
8282
throw e;
8383
}
8484
}

dd-java-agent/instrumentation/maven/maven-3.2.1/src/test/java/datadog/trace/instrumentation/maven3/MavenUtilsTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -498,22 +498,21 @@ private static String getLatestMavenSurefireVersion() {
498498
if (versionList.getLength() > 0) {
499499
String version = versionList.item(0).getTextContent();
500500
if (!version.contains("alpha") && !version.contains("beta")) {
501-
LOGGER.info("Will run the 'latest' tests with version " + version);
501+
LOGGER.info("Will run the 'latest' tests with version {}", version);
502502
return version;
503503
}
504504
}
505505
} else {
506506
LOGGER.warn(
507-
"Could not get latest Maven Surefire version, response from repo.maven.apache.org is "
508-
+ response.code()
509-
+ ":"
510-
+ response.body().string());
507+
"Could not get latest Maven Surefire version, response from repo.maven.apache.org is {}:{}",
508+
response.code(),
509+
response.body().string());
511510
}
512511
} catch (Exception e) {
513512
LOGGER.warn("Could not get latest Maven Surefire version", e);
514513
}
515514
String hardcodedLatestVersion = "3.5.0"; // latest version that is known to work
516-
LOGGER.info("Will run the 'latest' tests with hard-coded version " + hardcodedLatestVersion);
515+
LOGGER.info("Will run the 'latest' tests with hard-coded version {}", hardcodedLatestVersion);
517516
return hardcodedLatestVersion;
518517
}
519518
}

dd-smoke-tests/datastreams/kafkaschemaregistry/src/main/java/datadog/smoketest/datastreams/kafkaschemaregistry/KafkaProducerWithSchemaRegistry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static void produce() {
4848
new org.apache.kafka.clients.producer.KafkaProducer<>(properties);
4949

5050
Duration duration = Duration.newBuilder().setSeconds(10).build();
51-
log.info("duration is " + duration.getSeconds());
51+
log.info("duration is {}", duration.getSeconds());
5252

5353
try {
5454
for (int i = 1; i <= 20; i++) {

0 commit comments

Comments
 (0)