vcsomor commented on a change in pull request #3032:
URL: https://github.com/apache/hive/pull/3032#discussion_r808925697
##########
File path:
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/JsonReporter.java
##########
@@ -160,7 +158,7 @@ public void report(SortedMap<String, Gauge> sortedMap,
SortedMap<String, Counter
try (BufferedWriter bw = Files.newBufferedWriter(tmpFile,
StandardCharsets.UTF_8)) {
bw.write(json);
} catch (IOException e) {
- LOG.error("Unable to write to temp file {}" + tmpFile, e);
+ LOG.error("Unable to write to temp file {}", tmpFile, e);
Review comment:
This is not required because, the if the last element is a `Throwable`
then it will be handled outside of the string-extrapolation.
```java
String tmpFileX = "myfile";
try {
throw new RuntimeException("Casued by me");
} catch (RuntimeException e) {
LOG.error("Unable to write to temp file {}", tmpFileX, e);
}
```
output:
```log
[ERROR] 2022-02-17 11:59:03.456 [metrics-json-reporter-4-thread-1]
JsonReporter - Unable to write to temp file myfile
java.lang.RuntimeException: Casued by me
at
org.apache.hadoop.hive.metastore.metrics.JsonReporter.report(JsonReporter.java:140)
[classes/:?]
at
com.codahale.metrics.ScheduledReporter.report(ScheduledReporter.java:162)
[metrics-core-3.1.0.jar:3.1.0]
at
com.codahale.metrics.ScheduledReporter$1.run(ScheduledReporter.java:117)
[metrics-core-3.1.0.jar:3.1.0]
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[?:1.8.0_301]
at
java.util.concurrent.FutureTask.runAndReset$$$capture(FutureTask.java:308)
[?:1.8.0_301]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java)
[?:1.8.0_301]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
[?:1.8.0_301]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
[?:1.8.0_301]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[?:1.8.0_301]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[?:1.8.0_301]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_301]
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]