Skip to content

Commit

Permalink
[ISSUE #4733] Substitute e.printStackTrace() with log.error() (#4754)
Browse files Browse the repository at this point in the history
* Substitute e.printStackTrace() with log.error()

* add exception arg

* Modify the wording of the log
  • Loading branch information
scwlkq authored Jan 21, 2024
1 parent 39c8293 commit 1d30733
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class ThreadWrapperTest {

@Test
Expand Down Expand Up @@ -74,7 +77,7 @@ public void run() {
try {
TimeUnit.MILLISECONDS.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
log.error("[ThreadWrapperTest][shutdown] InterruptedException", e);
}
counter.set(100);
}
Expand Down Expand Up @@ -136,4 +139,4 @@ public void run() {
wrapper.setDaemon(daemon);
return wrapper;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ public void stop() {
try {
source.stop();
} catch (Exception e) {
e.printStackTrace();
log.error("source destroy error", e);
}
log.info("pollService stopping");
Expand Down Expand Up @@ -330,15 +329,15 @@ public boolean commitOffsets() {
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(),
committableOffsets.largestDequePartition(),
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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void close() {
task.cancel(false);
super.close();
} catch (Exception e) {
e.printStackTrace();
log.error("PubClientImpl|{}|close failed!", clientNo, e);
}
}

Expand Down

0 comments on commit 1d30733

Please sign in to comment.