diff --git a/requester/handler.hpp b/requester/handler.hpp
index 5fc5f7b..3b1eca5 100644
--- a/requester/handler.hpp
+++ b/requester/handler.hpp
@@ -145,16 +145,19 @@
         auto eid = key.eid;
         if (this->handlers.contains(key))
         {
-            error("The eid:InstanceID {EID}:{IID} is using.", "EID",
-                  (unsigned)key.eid, "IID", (unsigned)key.instanceId);
+            info(
+                "Instance ID expiry for EID '{EID}' using InstanceID '{INSTANCEID}'",
+                "EID", (unsigned)key.eid, "INSTANCEID",
+                (unsigned)key.instanceId);
             auto& [request, responseHandler,
                    timerInstance] = this->handlers[key];
             request->stop();
             auto rc = timerInstance->stop();
             if (rc)
             {
-                error("Failed to stop the instance ID expiry timer. RC = {RC}",
-                      "RC", static_cast<int>(rc));
+                error(
+                    "Failed to stop the instance ID expiry timer, response code '{RC}'",
+                    "RC", static_cast<int>(rc));
             }
             // Call response handler with an empty response to indicate no
             // response
@@ -205,7 +208,9 @@
         if (rc)
         {
             instanceIdDb.free(requestMsg->key.eid, requestMsg->key.instanceId);
-            error("Failure to send the PLDM request message");
+            error(
+                "Failure to send the PLDM request message for polling endpoint queue, response code '{RC}'",
+                "RC", rc);
             endpointMessageQueues[eid]->activeRequest = false;
             return rc;
         }
@@ -219,8 +224,8 @@
         {
             instanceIdDb.free(requestMsg->key.eid, requestMsg->key.instanceId);
             error(
-                "Failed to start the instance ID expiry timer. RC = {ERR_EXCEP}",
-                "ERR_EXCEP", e.what());
+                "Failed to start the instance ID expiry timer, error - {ERROR}",
+                "ERROR", e);
             endpointMessageQueues[eid]->activeRequest = false;
             return PLDM_ERROR;
         }
@@ -251,8 +256,9 @@
 
         if (handlers.contains(key))
         {
-            error("The eid:InstanceID {EID}:{IID} is using.", "EID",
-                  (unsigned)eid, "IID", (unsigned)instanceId);
+            error(
+                "Register request for EID '{EID}' is using InstanceID '{INSTANCEID}'",
+                "EID", (unsigned)eid, "INSTANCEID", (unsigned)instanceId);
             return PLDM_ERROR;
         }
 
@@ -297,8 +303,9 @@
             auto rc = timerInstance->stop();
             if (rc)
             {
-                error("Failed to stop the instance ID expiry timer. RC = {RC}",
-                      "RC", static_cast<int>(rc));
+                error(
+                    "Failed to stop the instance ID expiry timer, response code '{RC}'",
+                    "RC", static_cast<int>(rc));
             }
             responseHandler(eid, response, respMsgLen);
             instanceIdDb.free(key.eid, key.instanceId);
