This is an automated email from the ASF dual-hosted git repository.
xiatian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/eventmesh.git
The following commit(s) were added to refs/heads/master by this push:
new 1d307332d [ISSUE #4733] Substitute e.printStackTrace() with
log.error() (#4754)
1d307332d is described below
commit 1d307332d608df10f2bb383ff5db2c72fb492b79
Author: scwlkq <[email protected]>
AuthorDate: Sun Jan 21 16:13:13 2024 +0800
[ISSUE #4733] Substitute e.printStackTrace() with log.error() (#4754)
* Substitute e.printStackTrace() with log.error()
* add exception arg
* Modify the wording of the log
---
.../test/java/org/apache/eventmesh/common/ThreadWrapperTest.java | 7 +++++--
.../main/java/org/apache/eventmesh/openconnect/SourceWorker.java | 5 ++---
.../org/apache/eventmesh/runtime/client/impl/PubClientImpl.java | 2 +-
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git
a/eventmesh-common/src/test/java/org/apache/eventmesh/common/ThreadWrapperTest.java
b/eventmesh-common/src/test/java/org/apache/eventmesh/common/ThreadWrapperTest.java
index 6315911eb..a4f2a60f7 100644
---
a/eventmesh-common/src/test/java/org/apache/eventmesh/common/ThreadWrapperTest.java
+++
b/eventmesh-common/src/test/java/org/apache/eventmesh/common/ThreadWrapperTest.java
@@ -24,6 +24,9 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
public class ThreadWrapperTest {
@Test
@@ -74,7 +77,7 @@ public class ThreadWrapperTest {
try {
TimeUnit.MILLISECONDS.sleep(500);
} catch (InterruptedException e) {
- e.printStackTrace();
+ log.error("[ThreadWrapperTest][shutdown]
InterruptedException", e);
}
counter.set(100);
}
@@ -136,4 +139,4 @@ public class ThreadWrapperTest {
wrapper.setDaemon(daemon);
return wrapper;
}
-}
\ No newline at end of file
+}
diff --git
a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/SourceWorker.java
b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/SourceWorker.java
index bf9878e48..c5d4fe2b0 100644
---
a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/SourceWorker.java
+++
b/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/SourceWorker.java
@@ -276,7 +276,6 @@ public class SourceWorker implements ConnectorWorker {
try {
source.stop();
} catch (Exception e) {
- e.printStackTrace();
log.error("source destroy error", e);
}
log.info("pollService stopping");
@@ -330,7 +329,7 @@ public class SourceWorker implements ConnectorWorker {
log.info("{} Committing offsets for {} acknowledged messages",
this, committableOffsets.numCommittableMessages());
if (committableOffsets.hasPending()) {
log.debug("{} There are currently {} pending messages spread
across {} source partitions whose offsets will not be committed. "
- + "The source partition with the most pending messages is
{}, with {} pending messages",
+ + "The source partition with the most pending messages
is {}, with {} pending messages",
this,
committableOffsets.numUncommittableMessages(),
committableOffsets.numDeques(),
@@ -338,7 +337,7 @@ public class SourceWorker implements ConnectorWorker {
committableOffsets.largestDequeSize());
} else {
log.debug("{} There are currently no pending messages for this
offset commit; "
- + "all messages dispatched to the task's producer since
the last commit have been acknowledged",
+ + "all messages dispatched to the task's producer
since the last commit have been acknowledged",
this);
}
}
diff --git
a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/client/impl/PubClientImpl.java
b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/client/impl/PubClientImpl.java
index 734ad6fc5..cb6cf5dab 100644
---
a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/client/impl/PubClientImpl.java
+++
b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/client/impl/PubClientImpl.java
@@ -73,7 +73,7 @@ public class PubClientImpl extends TCPClient implements
PubClient {
task.cancel(false);
super.close();
} catch (Exception e) {
- e.printStackTrace();
+ log.error("PubClientImpl|{}|close failed!", clientNo, e);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]