Skip to content

Commit 46aa7d1

Browse files
committed
enable Slf4jFormatShouldBeConst
1 parent d9f79a2 commit 46aa7d1

72 files changed

Lines changed: 178 additions & 202 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,6 @@ class BeamModulePlugin implements Plugin<Project> {
15621562
"MutablePublicArray",
15631563
"NonCanonicalType",
15641564
"ProtectedMembersInFinalClass",
1565-
"Slf4jFormatShouldBeConst",
15661565
"Slf4jSignOnlyFormat",
15671566
"StaticAssignmentInConstructor",
15681567
"ThreadPriorityCheck",

it/common/src/main/java/org/apache/beam/it/common/utils/IORedirectUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static void redirectLinesLog(InputStream inputStream, Logger log) {
4141

4242
String line;
4343
while ((line = bis.readLine()) != null) {
44-
log.info(line);
44+
log.info("{}", line);
4545
}
4646
} catch (Exception e) {
4747
log.error("Error redirecting stream", e);

it/jdbc/src/main/java/org/apache/beam/it/jdbc/AbstractJDBCResourceManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public boolean write(String tableName, List<Map<String, Object>> rows)
210210
sql.append(String.join(",", valueList)).append(")");
211211

212212
try {
213-
LOG.info("Running SQL statement: " + sql);
213+
LOG.info("Running SQL statement: {}", sql);
214214
stmt.executeUpdate(sql.toString());
215215
} catch (SQLException e) {
216216
throw new JDBCResourceManagerException(

runners/core-java/src/main/java/org/apache/beam/runners/core/metrics/MetricsLogger.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void tryLoggingMetrics(
6161
long currentTimeMillis = System.currentTimeMillis();
6262
long lastReported = lastReportedMillis.get();
6363
if (currentTimeMillis - lastReported > minimumLoggingFrequencyMillis) {
64-
LOG.info(generateLogMessage(header, allowedMetricUrns, lastReported));
64+
LOG.info("{}", generateLogMessage(header, allowedMetricUrns, lastReported));
6565
lastReportedMillis.set(currentTimeMillis);
6666
}
6767
} finally {

runners/core-java/src/main/java/org/apache/beam/runners/core/metrics/SimpleExecutionState.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public String getLullMessage(Thread trackedThread, Duration millis) {
151151

152152
@Override
153153
public void reportLull(Thread trackedThread, long millis) {
154-
LOG.warn(getLullMessage(trackedThread, Duration.millis(millis)));
154+
LOG.warn("{}", getLullMessage(trackedThread, Duration.millis(millis)));
155155
}
156156

157157
@VisibleForTesting

runners/direct-java/src/main/java/org/apache/beam/runners/direct/DoFnLifecycleManagerRemovingTransformEvaluator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ private void onException(Exception e, String msg) {
8484
if (removalException instanceof InterruptedException) {
8585
Thread.currentThread().interrupt();
8686
}
87-
LOG.error(msg, removalException);
87+
LOG.error("{}", msg, removalException);
8888
e.addSuppressed(removalException);
8989
}
9090
}

runners/flink/src/main/java/org/apache/beam/runners/flink/FlinkStreamingPipelineTranslator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public void visitPrimitiveTransform(TransformHierarchy.Node node) {
133133

134134
if (translator == null || !applyCanTranslate(transform, node, translator)) {
135135
String transformUrn = PTransformTranslation.urnForTransform(transform);
136-
LOG.info(transformUrn);
136+
LOG.info("{}", transformUrn);
137137
throw new UnsupportedOperationException(
138138
"The transform " + transformUrn + " is currently not supported.");
139139
}

runners/java-fn-execution/src/main/java/org/apache/beam/runners/fnexecution/control/FnApiControlClientPoolService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public void getProcessBundleDescriptor(
117117
String msg =
118118
String.format("ProcessBundleDescriptor with id %s not found", bundleDescriptorId);
119119
responseObserver.onError(new StatusException(Status.NOT_FOUND.withDescription(msg)));
120-
LOG.error(msg);
120+
LOG.error("{}", msg);
121121
} else {
122122
responseObserver.onNext(descriptor);
123123
responseObserver.onCompleted();

runners/java-fn-execution/src/main/java/org/apache/beam/runners/fnexecution/logging/Slf4jLogWriter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public static LogWriter getDefault() {
3535
private Slf4jLogWriter() {}
3636

3737
@Override
38+
@SuppressWarnings("Slf4jFormatShouldBeConst")
3839
public void log(LogEntry entry) {
3940
Logger log;
4041
String location = entry.getLogLocation();

runners/java-fn-execution/src/main/java/org/apache/beam/runners/fnexecution/status/WorkerStatusClient.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ public void onNext(WorkerStatusResponse response) {
141141
future.complete(response);
142142
} else {
143143
LOG.warn(
144-
String.format(
145-
"Received response for status with unknown response id %s and status %s",
146-
response.getId(), response.getStatusInfo()));
144+
"Received response for status with unknown response id {} and status {}",
145+
response.getId(),
146+
response.getStatusInfo());
147147
}
148148
}
149149

0 commit comments

Comments
 (0)