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);
diff --git a/requester/mctp_endpoint_discovery.cpp b/requester/mctp_endpoint_discovery.cpp
index 0d63cb2..0d63ad4 100644
--- a/requester/mctp_endpoint_discovery.cpp
+++ b/requester/mctp_endpoint_discovery.cpp
@@ -48,8 +48,9 @@
     }
     catch (const sdbusplus::exception_t& e)
     {
-        error("getSubtree call failed with, {ERROR} {PATH} {INTERFACE}",
-              "ERROR", e, "PATH", MCTPPath, "INTERFACE", MCTPInterface);
+        error(
+            "Failed to getSubtree call at path '{PATH}' and interface '{INTERFACE}', error - {ERROR} ",
+            "ERROR", e, "PATH", MCTPPath, "INTERFACE", MCTPInterface);
         return;
     }
 
@@ -76,8 +77,9 @@
                     if (std::find(types.begin(), types.end(), mctpTypePLDM) !=
                         types.end())
                     {
-                        info("Adding Endpoint networkId={NETWORK} EID={EID}",
-                             "NETWORK", networkId, "EID", unsigned(eid));
+                        info(
+                            "Adding Endpoint networkId '{NETWORK}' and EID '{EID}'",
+                            "NETWORK", networkId, "EID", unsigned(eid));
                         mctpInfos.emplace_back(
                             MctpInfo(eid, emptyUUID, "", networkId));
                     }
@@ -86,7 +88,7 @@
             catch (const sdbusplus::exception_t& e)
             {
                 error(
-                    "Error reading MCTP Endpoint property, {ERROR} {SERVICE} {PATH}",
+                    "Error reading MCTP Endpoint property at path '{PATH}' and service '{SERVICE}', error - {ERROR}",
                     "ERROR", e, "SERVICE", service, "PATH", path);
                 return;
             }
@@ -109,8 +111,9 @@
     }
     catch (const sdbusplus::exception_t& e)
     {
-        error("Error reading MCTP Endpoint addedInterace message, {ERROR}",
-              "ERROR", e);
+        error(
+            "Error reading MCTP Endpoint added interface message, error - {ERROR}",
+            "ERROR", e);
         return;
     }
 
@@ -130,8 +133,9 @@
                 if (std::find(types.begin(), types.end(), mctpTypePLDM) !=
                     types.end())
                 {
-                    info("Adding Endpoint networkId={NETWORK} EID={EID}",
-                         "NETWORK", networkId, "EID", unsigned(eid));
+                    info(
+                        "Adding Endpoint networkId '{NETWORK}' and EID '{EID}'",
+                        "NETWORK", networkId, "EID", unsigned(eid));
                     mctpInfos.emplace_back(
                         MctpInfo(eid, emptyUUID, "", networkId));
                 }
@@ -165,8 +169,9 @@
     }
     for (const auto& mctpInfo : removedInfos)
     {
-        info("Removing Endpoint networkId={NETWORK} EID={EID}", "NETWORK",
-             std::get<3>(mctpInfo), "EID", unsigned(std::get<0>(mctpInfo)));
+        info("Removing Endpoint networkId '{NETWORK}' and  EID '{EID}'",
+             "NETWORK", std::get<3>(mctpInfo), "EID",
+             unsigned(std::get<0>(mctpInfo)));
         existingMctpInfos.erase(std::remove(existingMctpInfos.begin(),
                                             existingMctpInfos.end(), mctpInfo),
                                 existingMctpInfos.end());
diff --git a/requester/request.hpp b/requester/request.hpp
index cb4e026..ff17886 100644
--- a/requester/request.hpp
+++ b/requester/request.hpp
@@ -75,8 +75,8 @@
         }
         catch (const std::runtime_error& e)
         {
-            error("Failed to start the request timer. RC = {ERR_EXCEP}",
-                  "ERR_EXCEP", e.what());
+            error("Failed to start the request timer, error - {ERROR}", "ERROR",
+                  e);
             return PLDM_ERROR;
         }
 
@@ -89,8 +89,8 @@
         auto rc = timer.stop();
         if (rc)
         {
-            error("Failed to stop the request timer. RC = {RC}", "RC",
-                  static_cast<int>(rc));
+            error("Failed to stop the request timer, response code '{RC}'",
+                  "RC", static_cast<int>(rc));
         }
     }
 
@@ -195,8 +195,9 @@
                                          requestMsg.data(), requestMsg.size());
         if (rc < 0)
         {
-            error("Failed to send PLDM message. RC = {RC}, errno = {ERR}", "RC",
-                  static_cast<int>(rc), "ERR", errno);
+            error(
+                "Failed to send pldmTransport message, response code '{RC}' and error - {ERROR}",
+                "RC", static_cast<int>(rc), "ERROR", errno);
             return PLDM_ERROR;
         }
         return PLDM_SUCCESS;
