From ffad7112e17909fe2e0e8e32618d4db9461a135d Mon Sep 17 00:00:00 2001 From: StrikeW Date: Mon, 16 Dec 2024 21:42:39 +0800 Subject: [PATCH 1/2] print error --- .../com/risingwave/tracing/TracingSlf4jAdapter.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/java/connector-node/tracing/src/main/java/com/risingwave/tracing/TracingSlf4jAdapter.java b/java/connector-node/tracing/src/main/java/com/risingwave/tracing/TracingSlf4jAdapter.java index e0aee7633c518..dd552536d05e4 100644 --- a/java/connector-node/tracing/src/main/java/com/risingwave/tracing/TracingSlf4jAdapter.java +++ b/java/connector-node/tracing/src/main/java/com/risingwave/tracing/TracingSlf4jAdapter.java @@ -43,10 +43,12 @@ private void logIfEnabled(int level, String format, Object arg) { private void logIfEnabled(int level, String format, Object arg1, Object arg2) { if (TracingSlf4jImpl.isEnabled(level)) { - TracingSlf4jImpl.event( - name, - level, - new ParameterizedMessage(format, arg1, arg2).getFormattedMessage()); + var pm = new ParameterizedMessage(format, arg1, arg2); + if (null != pm.getThrowable()) { + logIfEnabled(level, pm.getFormattedMessage(), pm.getThrowable()); + } else { + TracingSlf4jImpl.event(name, level, pm.getFormattedMessage()); + } } } From 79cc63b1326365c6b4b03f5e8e1e746e7613ee19 Mon Sep 17 00:00:00 2001 From: StrikeW Date: Mon, 16 Dec 2024 21:53:23 +0800 Subject: [PATCH 2/2] add --- .../java/com/risingwave/tracing/TracingSlf4jAdapter.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/java/connector-node/tracing/src/main/java/com/risingwave/tracing/TracingSlf4jAdapter.java b/java/connector-node/tracing/src/main/java/com/risingwave/tracing/TracingSlf4jAdapter.java index dd552536d05e4..63be7fe4439e6 100644 --- a/java/connector-node/tracing/src/main/java/com/risingwave/tracing/TracingSlf4jAdapter.java +++ b/java/connector-node/tracing/src/main/java/com/risingwave/tracing/TracingSlf4jAdapter.java @@ -36,8 +36,12 @@ private void logIfEnabled(int level, String msg) { private void logIfEnabled(int level, String format, Object arg) { if (TracingSlf4jImpl.isEnabled(level)) { - TracingSlf4jImpl.event( - name, level, new ParameterizedMessage(format, arg).getFormattedMessage()); + var pm = new ParameterizedMessage(format, arg); + if (null != pm.getThrowable()) { + logIfEnabled(level, pm.getFormattedMessage(), pm.getThrowable()); + } else { + TracingSlf4jImpl.event(name, level, pm.getFormattedMessage()); + } } }