diff --git a/agent/src/main/java/com/intergral/deep/agent/poll/DriftAwareThread.java b/agent/src/main/java/com/intergral/deep/agent/poll/DriftAwareThread.java index e2dc444..70e1a4b 100644 --- a/agent/src/main/java/com/intergral/deep/agent/poll/DriftAwareThread.java +++ b/agent/src/main/java/com/intergral/deep/agent/poll/DriftAwareThread.java @@ -144,11 +144,11 @@ public void run() { } private void trace(final String msg) { - LOGGER.trace(msg); + LOGGER.trace(this.getName() + " - " + msg); } - private void error(final String msg, final Throwable throwable) { + void error(final String msg, final Throwable throwable) { LOGGER.error(this.getName() + " - " + msg, throwable); } diff --git a/agent/src/test/java/com/intergral/deep/agent/poll/DriftAwareThreadTest.java b/agent/src/test/java/com/intergral/deep/agent/poll/DriftAwareThreadTest.java index c9d2eaa..6036471 100644 --- a/agent/src/test/java/com/intergral/deep/agent/poll/DriftAwareThreadTest.java +++ b/agent/src/test/java/com/intergral/deep/agent/poll/DriftAwareThreadTest.java @@ -23,6 +23,7 @@ import java.util.concurrent.CountDownLatch; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.mockito.Mockito; class DriftAwareThreadTest { @@ -65,6 +66,12 @@ public long callback(final long duration, final long next) { assertTrue((lwrap.now + 10000) >= currentTimeMillis); } + @Test + void errorLogs() { + final DriftAwareThread spy = Mockito.spy(task); + spy.error("test error", new RuntimeException("test exception")); + Mockito.verify(spy, Mockito.times(1)).getName(); + } @Test public void testCheckForEarlyWakeUp() throws Exception {