[
https://issues.apache.org/jira/browse/RATIS-1946?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17791792#comment-17791792
]
Tsz-wo Sze commented on RATIS-1946:
-----------------------------------
[~adoroszlai], you are right. It works.
{code:java}
public static void main(String[] args) {
String a = "a";
String b = "b";
String c = "c";
LOG.warn("a={}, b={}, c={}", a, b, c, new Throwable());
}
{code}
{code:java}
2023-11-30 12:57:22,137 [main] WARN util.GrpcTestClient
(GrpcTestClient.java:main(131)) - a=a, b=b, c=c
java.lang.Throwable
at
org.apache.ratis.grpc.util.GrpcTestClient.main(GrpcTestClient.java:131)
{code}
> slf4j: Exception may not be printed.
> ------------------------------------
>
> Key: RATIS-1946
> URL: https://issues.apache.org/jira/browse/RATIS-1946
> Project: Ratis
> Issue Type: Improvement
> Reporter: Tsz-wo Sze
> Assignee: Tsz-wo Sze
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> The "{}" message format syntax does not work for exception.
> {code}
> //PeerProxyMap.java
> } catch (IOException e) {
> LOG.warn("{}: Failed to close proxy for peer {}, proxy class: {}",
> name, pp, proxy.getClass(), e);
> }
> {code}
> As an example, the exception e and its stack trace will not be printed in the
> code above since it is calling
> {code}
> //org.slf4j.Logger
> void warn(String var1, Object... var2);
> {code}
> with one "{}" less. There are three "{}" but four objects (including e).
> The expectation is to call
> {code}
> void warn(String var1, Object var2, Object var3, Object var4, Throwable
> var5);
> {code}
> but such method does not exist.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)