Add Object::toString to each log line
@@ -57,7 +57,7 @@ public class NodeAdminStateUpdater extends AbstractComponent {
Clock clock,
Orchestrator orchestrator,
String dockerHostHostName) {
- log.log(LogLevel.INFO, "NodeAdminStateUpdater created");
+ log.log(LogLevel.INFO, objectToString() + ": Creating object");
this.nodeRepository = nodeRepository;
this.nodeAdmin = nodeAdmin;
this.clock = clock;
@@ -66,6 +66,10 @@ public class NodeAdminStateUpdater extends AbstractComponent {
this.lastTick = clock.instant();
}
+ private String objectToString() {
+ return this.getClass().getName() + "@" + System.identityHashCode(this);
+ }
+
public enum State { RESUMED, SUSPENDED_NODE_ADMIN, SUSPENDED}
public Map<String, Object> getDebugPage() {
@@ -249,7 +253,7 @@ public class NodeAdminStateUpdater extends AbstractComponent {
if (!terminated.compareAndSet(false, true)) {
throw new RuntimeException("Can not re-stop a node agent.");
}
- log.log(LogLevel.INFO, "Deconstruct called");
+ log.log(LogLevel.INFO, objectToString() + ": Deconstruct called");
signalWorkToBeDone();
try {
loopThread.join(10000);
@@ -260,6 +264,6 @@ public class NodeAdminStateUpdater extends AbstractComponent {
log.log(LogLevel.ERROR, "Interrupted; Could not stop thread");
}
nodeAdmin.shutdown();
- log.log(LogLevel.INFO, "Deconstruct complete");
+ log.log(LogLevel.INFO, objectToString() + ": Deconstruct complete");
}
}
