libpldmresponder: Improving Logs (lg2)

This commit corrects the severity level of logs and also formats the
message string, fixing the ill-defined message string of the logs as
mentioned in the anti-pattern document [1]. Additionally, based on the
requirement this commit adds more debug information to logs.

[1]: https://github.com/openbmc/docs/blob/master/anti-patterns.md#ill-defined-data-structuring-in-lg2-message-strings

Change-Id: I7dc5c308a8cd76573995e07d01d1a6037bca31ba
Signed-off-by: Riya Dixit <riyadixitagra@gmail.com>
diff --git a/libpldmresponder/base.cpp b/libpldmresponder/base.cpp
index e0708a4..2eae049 100644
--- a/libpldmresponder/base.cpp
+++ b/libpldmresponder/base.cpp
@@ -8,8 +8,6 @@
 #include <libpldm/fru.h>
 #include <libpldm/platform.h>
 
-#include <phosphor-logging/lg2.hpp>
-
 #include <array>
 #include <cstring>
 #include <map>
@@ -21,8 +19,6 @@
 #include <libpldm/oem/ibm/host.h>
 #endif
 
-PHOSPHOR_LOG2_USING;
-
 namespace pldm
 {
 using Type = uint8_t;
diff --git a/libpldmresponder/bios.cpp b/libpldmresponder/bios.cpp
index 48a3f28..d97229d 100644
--- a/libpldmresponder/bios.cpp
+++ b/libpldmresponder/bios.cpp
@@ -133,7 +133,7 @@
     catch (const sdbusplus::exception_t& e)
     {
         error(
-            "Error getting time from Elapsed property at '{PATH}' on '{INTERFACE}': {ERROR}",
+            "Error getting time from Elapsed property at path '{PATH}' on interface '{INTERFACE}': {ERROR}",
             "PATH", bmcTimePath, "INTERFACE", timeInterface, "ERROR", e);
         return CmdHandler::ccOnlyResponse(request, PLDM_ERROR);
     }
@@ -187,9 +187,9 @@
     catch (const std::exception& e)
     {
         error(
-            "Error getting the time sync property, PATH={TIME_SYNC_PATH} INTERFACE={SYNC_INTERFACE} PROPERTY={SYNC_PROP} ERROR={ERR_EXCEP}",
+            "Failed to get the time sync property from path {TIME_SYNC_PATH}, interface '{SYNC_INTERFACE}' and property '{SYNC_PROPERTY}', error - '{ERROR}'",
             "TIME_SYNC_PATH", timeSyncPath, "SYNC_INTERFACE", timeSyncInterface,
-            "SYNC_PROP", timeSyncProperty, "ERR_EXCEP", e.what());
+            "SYNC_PROPERTY", timeSyncProperty, "ERROR", e);
     }
 
     constexpr auto setTimeInterface = "xyz.openbmc_project.Time.EpochTime";
@@ -217,9 +217,9 @@
     catch (const std::exception& e)
     {
         error(
-            "Error Setting time,PATH={SET_TIME_PATH} TIME INTERFACE={TIME_INTERFACE} ERROR={ERR_EXCEP}",
+            "Failed to set time at {SET_TIME_PATH}, interface '{TIME_INTERFACE}' and error - {ERROR}",
             "SET_TIME_PATH", setTimePath, "TIME_INTERFACE", setTimeInterface,
-            "ERR_EXCEP", e.what());
+            "ERROR", e);
         return ccOnlyResponse(request, PLDM_ERROR);
     }
 
diff --git a/libpldmresponder/bios_config.cpp b/libpldmresponder/bios_config.cpp
index c45cd3e..699e0d5 100644
--- a/libpldmresponder/bios_config.cpp
+++ b/libpldmresponder/bios_config.cpp
@@ -528,8 +528,8 @@
     }
     catch (const std::exception& e)
     {
-        error("failed to update BaseBIOSTable property, ERROR={ERR_EXCEP}",
-              "ERR_EXCEP", e.what());
+        error("Failed to update BaseBIOSTable property, error - {ERROR}",
+              "ERROR", e);
     }
 }
 
@@ -578,8 +578,8 @@
     // bios-settings-manager in sync
     catch (const std::exception& e)
     {
-        error("Failed to read BaseBIOSTable property, ERROR={ERR_EXCEP}",
-              "ERR_EXCEP", e.what());
+        error("Failed to read BaseBIOSTable property, error - {ERROR}", "ERROR",
+              e);
     }
 
     Table attrTable, attrValueTable;
@@ -604,8 +604,9 @@
         }
         catch (const std::exception& e)
         {
-            error("Error constructing table entry for '{ATTR}': {ERROR}",
-                  "ATTR", attr->name, "ERROR", e);
+            error(
+                "Failed to construct table entry for attribute '{ATTRIBUTE}', error - {ERROR}",
+                "ATTRIBUTE", attr->name, "ERROR", e);
         }
     }
 
@@ -688,15 +689,15 @@
                 catch (const std::exception& e)
                 {
                     error(
-                        "Failed to parse JSON config file(entry handler) : {JSON_PATH}, {ERR_EXCEP}",
-                        "JSON_PATH", filePath.c_str(), "ERR_EXCEP", e.what());
+                        "Failed to parse JSON config file at path '{PATH}', error - {ERROR}",
+                        "PATH", filePath.c_str(), "ERROR", e);
                 }
             }
         }
         catch (const std::exception& e)
         {
-            error("Failed to parse JSON config at '{PATH}': {ERROR}", "PATH",
-                  filePath.c_str(), "ERROR", e);
+            error("Failed to parse JSON config file '{PATH}', error - {ERROR}",
+                  "PATH", filePath.c_str(), "ERROR", e);
         }
     }
 }
@@ -726,8 +727,8 @@
     if (rc != PLDM_SUCCESS)
     {
         error(
-            "Failed to decode BIOS table possible values for attribute entry: {LIPBLDM_ERROR}",
-            "LIBPLDM_ERROR", rc);
+            "Failed to decode BIOS table possible values for attribute entry, response code '{RC}'",
+            "RC", rc);
         throw std::runtime_error(
             "Failed to decode BIOS table possible values for attribute entry");
     }
@@ -778,8 +779,8 @@
                                                  stringTable);
                 auto chkBMC = isBMC ? "true" : "false";
                 info(
-                    "BIOS: {ATTR_NAME}, updated to value: {NEW_VAL}, by BMC: {CHK_BMC} ",
-                    "ATTR_NAME", attrName, "NEW_VAL", nwVal, "CHK_BMC", chkBMC);
+                    "BIOS attribute '{ATTRIBUTE}' updated to value '{VALUE}' by BMC '{CHECK_BMC}'",
+                    "ATTRIBUTE", attrName, "VALUE", nwVal, "CHECK_BMC", chkBMC);
             }
             break;
         }
@@ -790,8 +791,8 @@
                 table::attribute_value::decodeIntegerEntry(attrValueEntry);
             auto chkBMC = isBMC ? "true" : "false";
             info(
-                "BIOS: {ATTR_NAME}, updated to value: {UPDATED_VAL}, by BMC: {CHK_BMC}",
-                "ATTR_NAME", attrName, "UPDATED_VAL", value, "CHK_BMC", chkBMC);
+                "BIOS attribute '{ATTRIBUTE}' updated to value '{VALUE}' by BMC '{CHECK_BMC}'",
+                "ATTRIBUTE", attrName, "VALUE", value, "CHECK_BMC", chkBMC);
             break;
         }
         case PLDM_BIOS_STRING:
@@ -801,8 +802,8 @@
                 table::attribute_value::decodeStringEntry(attrValueEntry);
             auto chkBMC = isBMC ? "true" : "false";
             info(
-                "BIOS: {ATTR_NAME}, updated to value: {UPDATED_VAL}, by BMC: {CHK_BMC}",
-                "ATTR_NAME", attrName, "UPDATED_VAL", value, "CHK_BMC", chkBMC);
+                "BIOS attribute '{ATTRIBUTE}' updated to value '{VALUE}' by BMC '{CHECK_BMC}'",
+                "ATTRIBUTE", attrName, "VALUE", value, "CHECK_BMC", chkBMC);
             break;
         }
         default:
@@ -833,8 +834,9 @@
             }
             if (value[0] >= pvHdls.size())
             {
-                error("Enum: Illgeal index, Index = {ATTR_INDEX}", "ATTR_INDEX",
-                      (int)value[0]);
+                error(
+                    "Invalid index '{INDEX}' encountered for Enum type BIOS attribute",
+                    "INDEX", (int)value[0]);
                 return PLDM_ERROR_INVALID_DATA;
             }
             return PLDM_SUCCESS;
@@ -849,8 +851,10 @@
 
             if (value < lower || value > upper)
             {
-                error("Integer: out of bound, value = {ATTR_VALUE}",
-                      "ATTR_VALUE", value);
+                error(
+                    "Out of range index '{ATTRIBUTE_VALUE}' encountered for Integer type BIOS attribute for the lower bound '{LOWER}', the upper bound '{UPPER}' and the scalar value '{SCALAR}'.",
+                    "ATTRIBUTE_VALUE", value, "LOWER", lower, "UPPER", upper,
+                    "SCALAR", scalar);
                 return PLDM_ERROR_INVALID_DATA;
             }
             return PLDM_SUCCESS;
@@ -865,15 +869,15 @@
                 value.size() > stringConf.maxLength)
             {
                 error(
-                    "String: Length error, string = {ATTR_VALUE} length {LEN}",
-                    "ATTR_VALUE", value, "LEN", value.size());
+                    "Invalid length '{LENGTH}' encountered for string type BIOS attribute value '{ATTRIBUTE_VALUE}' when minimum string entry length '{MIN_LEN}' and maximum string entry length '{MAX_LEN}'",
+                    "ATTRIBUTE_VALUE", value, "LENGTH", value.size(), "MIN_LEN",
+                    stringConf.minLength, "MAX_LEN", stringConf.maxLength);
                 return PLDM_ERROR_INVALID_LENGTH;
             }
             return PLDM_SUCCESS;
         }
         default:
-            error("ReadOnly or Unspported type, type = {ATTR_TYPE}",
-                  "ATTR_TYPE", attrType);
+            error("ReadOnly or Unsupported type '{TYPE}'", "TYPE", attrType);
             return PLDM_ERROR;
     };
 }
@@ -937,7 +941,7 @@
     }
     catch (const std::exception& e)
     {
-        error("Set attribute value error: {ERR_EXCEP}", "ERR_EXCEP", e.what());
+        error("Set attribute value error - {ERROR}", "ERROR", e);
         return PLDM_ERROR;
     }
 
@@ -958,7 +962,7 @@
     }
     catch (const std::exception& e)
     {
-        error("Remove the tables error: {ERR_EXCEP}", "ERR_EXCEP", e.what());
+        error("Remove the tables error - {ERROR}", "ERROR", e);
     }
 }
 
@@ -990,15 +994,16 @@
     }
     catch (const std::invalid_argument& e)
     {
-        error("Missing handle for '{ATTR}': {ERROR}", "ATTR", attrName, "ERROR",
-              e);
+        error(
+            "Missing handle for attribute '{ATTRIBUTE}' in BIOS String Table, error - '{ERROR}'",
+            "ATTRIBUTE", attrName, "ERROR", e);
         return;
     }
 
     auto attrTable = getBIOSTable(PLDM_BIOS_ATTR_TABLE);
     if (!attrTable.has_value())
     {
-        error("Attribute table not present");
+        error("BIOS Attribute table not present");
         return;
     }
     const struct pldm_bios_attr_table_entry* tableEntry =
@@ -1006,8 +1011,8 @@
     if (tableEntry == nullptr)
     {
         error(
-            "Attribute not found in attribute table, name= {ATTR_NAME} name handle={ATTR_HANDLE}",
-            "ATTR_NAME", attrName.c_str(), "ATTR_HANDLE", attrNameHdl);
+            "Failed to find attribute {ATTRIBUTE} in BIOS Attribute table with attribute handle '{ATTR_HANDLE}'",
+            "ATTRIBUTE", attrName, "ATTR_HANDLE", attrNameHdl);
         return;
     }
 
@@ -1028,8 +1033,8 @@
     if (rc != PLDM_SUCCESS)
     {
         error(
-            "Could not update the attribute value table for attribute handle={ATTR_HANDLE} and type={ATTR_TYPE}",
-            "ATTR_HANDLE", attrHdl, "ATTR_TYPE", (uint32_t)attrType);
+            "Failed to update the attribute value table for attribute handle '{ATTR_HANDLE}' and  attribute type '{TYPE}'",
+            "ATTR_HANDLE", attrHdl, "TYPE", (uint32_t)attrType);
         return;
     }
     auto destTable = table::attribute_value::updateTable(
@@ -1042,8 +1047,9 @@
     rc = setAttrValue(newValue.data(), newValue.size(), true, false);
     if (rc != PLDM_SUCCESS)
     {
-        error("could not setAttrValue on base bios table and dbus, rc = {RC}",
-              "RC", rc);
+        error(
+            "Failed to setAttrValue on base bios table and dbus, response code '{RC}'",
+            "RC", rc);
     }
 }
 
@@ -1087,8 +1093,7 @@
 
         if (iter == biosAttributes.end())
         {
-            error("Wrong attribute name, attributeName = {ATTR_NAME}",
-                  "ATTR_NAME", attributeName);
+            error("Wrong attribute name {NAME}", "NAME", attributeName);
             continue;
         }
 
@@ -1104,8 +1109,8 @@
             type != BIOSConfigManager::AttributeType::String &&
             type != BIOSConfigManager::AttributeType::Integer)
         {
-            error("Attribute type not supported, attributeType = {ATTR_TYPE}",
-                  "ATTR_TYPE", attributeType);
+            error("Attribute type '{TYPE}' not supported", "TYPE",
+                  attributeType);
             continue;
         }
 
diff --git a/libpldmresponder/bios_config.hpp b/libpldmresponder/bios_config.hpp
index dba7a09..7818ac4 100644
--- a/libpldmresponder/bios_config.hpp
+++ b/libpldmresponder/bios_config.hpp
@@ -262,8 +262,8 @@
         }
         catch (const std::exception& e)
         {
-            error("Constructs Attribute Error, {ERR_EXCEP}", "ERR_EXCEP",
-                  e.what());
+            error("Failed to construct an attribute, error - {ERROR}", "ERROR",
+                  e);
         }
     }
 
diff --git a/libpldmresponder/bios_enum_attribute.cpp b/libpldmresponder/bios_enum_attribute.cpp
index 437830e..5d436c1 100644
--- a/libpldmresponder/bios_enum_attribute.cpp
+++ b/libpldmresponder/bios_enum_attribute.cpp
@@ -119,7 +119,7 @@
         }
         else
         {
-            error("Unknown D-Bus property type, TYPE={PROP_TYPE}", "PROP_TYPE",
+            error("Unknown D-Bus property type '{TYPE}'", "TYPE",
                   dBusMap->propertyType);
             throw std::invalid_argument("Unknown D-BUS property type");
         }
@@ -253,8 +253,8 @@
     auto iter = valMap.find(newPropVal);
     if (iter == valMap.end())
     {
-        error("Could not find index for new BIOS enum, value={PROP_VAL}",
-              "PROP_VAL", std::get<std::string>(newPropVal));
+        error("Failed to find index for new BIOS enum value '{VALUE}'", "VALUE",
+              std::get<std::string>(newPropVal));
         return PLDM_ERROR;
     }
     auto currentValue = iter->second;
diff --git a/libpldmresponder/bios_integer_attribute.cpp b/libpldmresponder/bios_integer_attribute.cpp
index fa338dc..8c343c7 100644
--- a/libpldmresponder/bios_integer_attribute.cpp
+++ b/libpldmresponder/bios_integer_attribute.cpp
@@ -37,10 +37,10 @@
     if (rc != PLDM_SUCCESS)
     {
         error(
-            "Wrong field for integer attribute, ATTRIBUTE_NAME={ATTR_NAME} ERRMSG= {ERR_MSG} LOWER_BOUND={LOW_BOUND} UPPER_BOUND={UPPER_BOUND} DEFAULT_VALUE={DEF_VAL} SCALAR_INCREMENT={SCALAR_INCREMENT}",
-            "ATTR_NAME", attr.c_str(), "ERR_MSG", errmsg, "LOW_BOUND",
+            "Wrong field for integer attribute '{ATTRIBUTE}', error '{ERROR}', lower bound '{LOW_BOUND}', upper bound '{UPPER_BOUND}', default value '{DEFAULT_VALUE}' and scalar increament '{SCALAR_INCREMENT}'",
+            "ATTRIBUTE", attr, "ERROR", errmsg, "LOW_BOUND",
             integerInfo.lowerBound, "UPPER_BOUND", integerInfo.upperBound,
-            "DEF_VAL", integerInfo.defaultValue, "SCALAR_INCREMENT",
+            "DEFAULT_VALUE", integerInfo.defaultValue, "SCALAR_INCREMENT",
             integerInfo.scalarIncrement);
         throw std::invalid_argument("Wrong field for integer attribute");
     }
@@ -97,7 +97,7 @@
                                             static_cast<double>(currentValue));
     }
 
-    error("Unsupported property type on dbus: {DBUS_PROP}", "DBUS_PROP",
+    error("Unsupported property type '{TYPE}' on dbus", "TYPE",
           dBusMap->propertyType);
     throw std::invalid_argument("dbus type error");
 }
@@ -177,8 +177,8 @@
     }
     else
     {
-        error("Unsupported property type for getAttrValue: {DBUS_PROP}",
-              "DBUS_PROP", dBusMap->propertyType);
+        error("Unsupported property type '{TYPE}' for getAttrValue", "TYPE",
+              dBusMap->propertyType);
         throw std::invalid_argument("dbus type error");
     }
     return value;
@@ -202,8 +202,9 @@
     catch (const std::exception& e)
     {
         error(
-            "Error getting integer attribute '{ATTR}' from '{INTERFACE}': {ERROR}",
-            "ATTR", name, "INTERFACE", dBusMap->interface, "ERROR", e);
+            "Error getting integer attribute '{ATTRIBUTE}' at path '{PATH}' and interface '{INTERFACE}' for property '{PROPERTY}', error - {ERROR}",
+            "ATTRIBUTE", name, "PATH", dBusMap->objectPath, "INTERFACE",
+            dBusMap->interface, "PROPERTY", dBusMap->propertyName, "ERROR", e);
         return integerInfo.defaultValue;
     }
 }
diff --git a/libpldmresponder/bios_string_attribute.cpp b/libpldmresponder/bios_string_attribute.cpp
index 28dde14..d52cdc4 100644
--- a/libpldmresponder/bios_string_attribute.cpp
+++ b/libpldmresponder/bios_string_attribute.cpp
@@ -25,9 +25,8 @@
     auto iter = strTypeMap.find(strTypeTmp);
     if (iter == strTypeMap.end())
     {
-        error(
-            "Wrong string type, STRING_TYPE={STR_TYPE} ATTRIBUTE_NAME={ATTR_NAME}",
-            "STR_TYP", strTypeTmp, "ATTR_NAME", name);
+        error("Wrong string type '{TYPE}' for attribute '{ATTRIBUTE}'", "TYPE",
+              strTypeTmp, "ATTRIBUTE", name);
         throw std::invalid_argument("Wrong string type");
     }
     stringInfo.stringType = static_cast<uint8_t>(iter->second);
@@ -52,10 +51,11 @@
     if (rc != PLDM_SUCCESS)
     {
         error(
-            "Wrong field for string attribute, ATTRIBUTE_NAME={ATTR_NAME} ERRMSG={ERR_MSG} MINIMUM_STRING_LENGTH={MIN_LEN} MAXIMUM_STRING_LENGTH={MAX_LEN} DEFAULT_STRING_LENGTH={DEF_LEN} DEFAULT_STRING={DEF_STR}",
-            "ATTR_NAME", name, "ERR_MSG", errmsg, "MIN_LEN",
-            stringInfo.minLength, "MAX_LEN", stringInfo.maxLength, "DEF_LEN",
-            stringInfo.defLength, "DEF_STR", stringInfo.defString);
+            "Wrong field for string attribute '{ATTRIBUTE}', error '{ERROR}', minimum string length '{MINIMUM_STRING_LENGTH}', maximum string length '{MAXIMUM_STRING_LENGTH}', default string length '{DEFAULT_STRING_LENGTH}' and default string '{DEFAULT_STRING}'",
+            "ATTRIBUTE", name, "ERROR", errmsg, "MINIMUM_STRING_LENGTH",
+            stringInfo.minLength, "MAXIMUM_STRING_LENGTH", stringInfo.maxLength,
+            "DEFAULT_STRING_LENGTH", stringInfo.defLength, "DEFAULT_STRING",
+            stringInfo.defString);
         throw std::invalid_argument("Wrong field for string attribute");
     }
 }
@@ -89,8 +89,9 @@
     catch (const std::exception& e)
     {
         error(
-            "Error getting string attribute '{ATTR}' from '{INTERFACE}': {ERROR}",
-            "ATTR", name, "INTERFACE", dBusMap->interface, "ERROR", e);
+            "Failed to get string attribute '{ATTRIBUTE}' at path '{PATH}' and interface '{INTERFACE}' for property '{PROPERTY}', error - {ERROR}",
+            "ATTRIBUTE", name, "PATH", dBusMap->objectPath, "INTERFACE",
+            dBusMap->interface, "PROPERTY", dBusMap->propertyName, "ERROR", e);
         return stringInfo.defString;
     }
 }
@@ -145,8 +146,7 @@
     }
     catch (const std::bad_variant_access& e)
     {
-        error("invalid value passed for the property, error: {ERR_EXCEP}",
-              "ERR_EXCEP", e.what());
+        error("Invalid value passed for the property - {ERROR}", "ERROR", e);
         return PLDM_ERROR;
     }
     return PLDM_SUCCESS;
diff --git a/libpldmresponder/bios_table.cpp b/libpldmresponder/bios_table.cpp
index 1b28a53..b264ea7 100644
--- a/libpldmresponder/bios_table.cpp
+++ b/libpldmresponder/bios_table.cpp
@@ -8,6 +8,8 @@
 
 #include <fstream>
 
+PHOSPHOR_LOG2_USING;
+
 namespace pldm
 {
 namespace responder
@@ -156,8 +158,8 @@
         table.data() + tableSize, entryLength, info);
     if (rc != PLDM_SUCCESS)
     {
-        lg2::error("Failed to encode BIOS table string entry: {LIBPLDM_ERROR}",
-                   "LIBPLDM_ERROR", rc);
+        error("Failed to encode BIOS table string entry, response code '{RC}'",
+              "RC", rc);
         throw std::runtime_error("Failed to encode BIOS table string entry");
     }
     return reinterpret_cast<pldm_bios_attr_table_entry*>(table.data() +
@@ -175,9 +177,9 @@
         table.data() + tableSize, entryLength, info);
     if (rc != PLDM_SUCCESS)
     {
-        lg2::error(
-            "Failed to encode BIOS attribute table integer entry: {LIBPLDM_ERROR}",
-            "LIBPLDM_ERROR", rc);
+        error(
+            "Failed to encode BIOS attribute table integer entry, response code '{RC}'",
+            "RC", rc);
         throw std::runtime_error(
             "Failed to encode BIOS attribute table integer entry");
     }
@@ -195,9 +197,9 @@
         entry, &defLength);
     if (rc != PLDM_SUCCESS)
     {
-        lg2::error(
-            "Failed to decode BIOS table string definition length: {LIBPLDM_ERROR}",
-            "LIBPLDM_ERROR", rc);
+        error(
+            "Failed to decode BIOS table string definition length, response code '{RC}'",
+            "RC", rc);
         throw std::runtime_error(
             "Failed to decode BIOS table string definitionlength");
     }
@@ -241,9 +243,9 @@
     int rc = pldm_bios_table_attr_entry_enum_decode_pv_num_check(entry, &pvNum);
     if (rc != PLDM_SUCCESS)
     {
-        lg2::error(
-            "Failed to decode the number of possible values for BIOS table enum entry: {LIBPLDM_ERROR}",
-            "LIBPLDM_ERROR", rc);
+        error(
+            "Failed to decode the number of possible values for BIOS table enum entry, response code '{RC}'",
+            "RC", rc);
         throw std::runtime_error(
             "Failed to decode the number of possible values for BIOS table enum entry");
     }
@@ -310,9 +312,9 @@
         str.c_str());
     if (rc != PLDM_SUCCESS)
     {
-        lg2::error(
-            "Failed to encode BIOS attribute table string entry: {LIBPLDM_ERROR}",
-            "LIBPLDM_ERROR", rc);
+        error(
+            "Failed to encode BIOS attribute table string entry, response code '{RC}'",
+            "RC", rc);
         throw std::runtime_error(
             "Failed to encode BIOS attribute table string entry");
     }
@@ -333,9 +335,9 @@
         table.data() + tableSize, entryLength, attrHandle, attrType, value);
     if (rc != PLDM_SUCCESS)
     {
-        lg2::error(
-            "Failed to encode BIOS attribute table integer entry: {LIBPLDM_ERROR}",
-            "LIBPLDM_ERROR", rc);
+        error(
+            "Failed to encode BIOS attribute table integer entry, response code '{RC}'",
+            "RC", rc);
         throw std::runtime_error(
             "Failed to encode BIOS attribute table integery entry");
     }
@@ -356,9 +358,9 @@
         handleIndices.size(), handleIndices.data());
     if (rc != PLDM_SUCCESS)
     {
-        lg2::error(
-            "Failed to encode BIOS attribute table enum entry: {LIBPLDM_ERROR}",
-            "LIBPLDM_ERROR", rc);
+        error(
+            "Failed to encode BIOS attribute table enum entry, response code '{RC}'",
+            "RC", rc);
         throw std::runtime_error(
             "Failed to encode BIOS attribute table enum entry");
     }
diff --git a/libpldmresponder/event_parser.cpp b/libpldmresponder/event_parser.cpp
index 23ffa2c..611c7ec 100644
--- a/libpldmresponder/event_parser.cpp
+++ b/libpldmresponder/event_parser.cpp
@@ -27,8 +27,8 @@
     fs::path dir(dirPath);
     if (!fs::exists(dir) || fs::is_empty(dir))
     {
-        error("Event config directory does not exist or empty, DIR={DIR_PATH}",
-              "DIR_PATH", dirPath.c_str());
+        error("Event config directory at '{PATH}' does not exist or empty",
+              "PATH", dirPath.c_str());
         return;
     }
 
@@ -39,9 +39,8 @@
         auto data = Json::parse(jsonFile, nullptr, false);
         if (data.is_discarded())
         {
-            error(
-                "Parsing Event state sensor JSON file failed, FILE={FILE_PATH}",
-                "FILE_PATH", file.path().c_str());
+            error("Failed to parse event state sensor JSON file at '{PATH}'",
+                  "PATH", file.path().c_str());
             continue;
         }
 
@@ -72,10 +71,10 @@
                 !supportedDbusPropertyTypes.contains(dbusInfo.propertyType))
             {
                 error(
-                    "Invalid dbus config, OBJPATH= {DBUS_OBJ_PATH} INTERFACE={DBUS_INTF} PROPERTY_NAME={DBUS_PROP} PROPERTY_TYPE={DBUS_PROP_TYPE}",
-                    "DBUS_OBJ_PATH", dbusInfo.objectPath.c_str(), "DBUS_INTF",
-                    dbusInfo.interface, "DBUS_PROP", dbusInfo.propertyName,
-                    "DBUS_PROP_TYPE", dbusInfo.propertyType);
+                    "Invalid dbus config at '{PATH}', interface '{DBUS_INTERFACE}', property name '{PROPERTY_NAME}' and property type '{PROPERTY_TYPE}'",
+                    "PATH", dbusInfo.objectPath.c_str(), "DBUS_INTERFACE",
+                    dbusInfo.interface, "PROPERTY_NAME", dbusInfo.propertyName,
+                    "PROPERTY_TYPE", dbusInfo.propertyType);
                 continue;
             }
 
@@ -85,9 +84,9 @@
                 (eventStates.size() != propertyValues.size()))
             {
                 error(
-                    "Invalid event state JSON config, EVENT_STATE_SIZE={EVENT_STATE_SIZE} PROPERTY_VALUE_SIZE={PROP_VAL_SIZE}",
-                    "EVENT_STATE_SIZE", eventStates.size(), "PROP_VAL_SIZE",
-                    propertyValues.size());
+                    "Invalid event state JSON config size '{EVENT_STATE_SIZE}' and property value size '{PROPERTY_VALUE_SIZE}'",
+                    "EVENT_STATE_SIZE", eventStates.size(),
+                    "PROPERTY_VALUE_SIZE", propertyValues.size());
                 continue;
             }
 
@@ -129,8 +128,8 @@
         }
         catch (const std::out_of_range& e)
         {
-            error("Invalid event state '{EVENT_STATE}': {ERROR}", "EVENT_STATE",
-                  state, "ERROR", e);
+            error("Invalid event state '{EVENT_STATE}', error - {ERROR}",
+                  "EVENT_STATE", state, "ERROR", e);
             return PLDM_ERROR_INVALID_DATA;
         }
 
@@ -141,7 +140,7 @@
         catch (const std::exception& e)
         {
             error(
-                "Error setting property value '{PROPERTY}' on interface '{INTERFACE}' at '{PATH}': {ERROR}",
+                "Failed to  set property '{PROPERTY}' on interface '{INTERFACE}' at path '{PATH}', error - {ERROR}",
                 "PROPERTY", dbusMapping.propertyName, "INTERFACE",
                 dbusMapping.interface, "PATH", dbusMapping.objectPath, "ERROR",
                 e);
diff --git a/libpldmresponder/fru.cpp b/libpldmresponder/fru.cpp
index d9702ff..be8f573 100644
--- a/libpldmresponder/fru.cpp
+++ b/libpldmresponder/fru.cpp
@@ -154,8 +154,9 @@
     }
     catch (const std::exception& e)
     {
-        error("Failed building FRU table due to inventory lookup: {ERROR}",
-              "ERROR", e);
+        error(
+            "Failed to build FRU table due to inventory lookup, error - {ERROR}",
+            "ERROR", e);
         return;
     }
 
@@ -198,8 +199,8 @@
                 catch (const std::exception& e)
                 {
                     error(
-                        "Config JSONs missing for the item interface type, interface = {INTF}",
-                        "INTF", interface.first);
+                        "Config JSONs missing for the item '{INTERFACE}', error - {ERROR}",
+                        "INTERFACE", interface.first, "ERROR", e);
                     break;
                 }
             }
@@ -211,8 +212,8 @@
     if (rc < 0)
     {
         // pldm_entity_assocation_pdr_add() assert()ed on failure
-        error("Failed to add PLDM entity association PDR: {LIBPLDM_ERROR}",
-              "LIBPLDM_ERROR", rc);
+        error("Failed to add PLDM entity association PDR, response code '{RC}'",
+              "RC", rc);
         throw std::runtime_error("Failed to add PLDM entity association PDR");
     }
 
@@ -244,8 +245,8 @@
     }
     catch (const std::exception& e)
     {
-        error("failed to make a d-bus call Asociation, ERROR= {ERR_EXCEP}",
-              "ERR_EXCEP", e.what());
+        error("Failed to make a d-bus call Asociation, error - {ERROR}",
+              "ERROR", e);
         return {};
     }
     return currentBmcVersion;
diff --git a/libpldmresponder/fru_parser.cpp b/libpldmresponder/fru_parser.cpp
index c875ffa..364a26b 100644
--- a/libpldmresponder/fru_parser.cpp
+++ b/libpldmresponder/fru_parser.cpp
@@ -48,9 +48,8 @@
     auto data = Json::parse(jsonFile, nullptr, false);
     if (data.is_discarded())
     {
-        error(
-            "Parsing FRU Dbus Lookup Map config file failed, FILE={JSON_PATH}",
-            "JSON_PATH", masterJsonPath.c_str());
+        error("Failed to parse FRU Dbus Lookup Map config file '{PATH}'",
+              "PATH", masterJsonPath.c_str());
         std::abort();
     }
     std::map<Interface, EntityType> defIntfToEntityType;
@@ -65,7 +64,8 @@
         }
         catch (const std::exception& e)
         {
-            error("FRU DBus lookup map format error: {ERROR}", "ERROR", e);
+            error("Failure in FRU dbus lookup map format, error - {ERROR}",
+                  "ERROR", e);
             throw InternalFailure();
         }
     }
@@ -117,8 +117,8 @@
         auto data = Json::parse(jsonFile, nullptr, false);
         if (data.is_discarded())
         {
-            error("Parsing FRU config file failed, FILE={FILE_PATH}",
-                  "FILE_PATH", file.path().c_str());
+            error("Failed to parse FRU config file at '{PATH}'", "PATH",
+                  file.path().c_str());
             throw InternalFailure();
         }
 
diff --git a/libpldmresponder/pdr_numeric_effecter.hpp b/libpldmresponder/pdr_numeric_effecter.hpp
index b213912..a425da3 100644
--- a/libpldmresponder/pdr_numeric_effecter.hpp
+++ b/libpldmresponder/pdr_numeric_effecter.hpp
@@ -217,9 +217,9 @@
         catch (const std::exception& e)
         {
             error(
-                "D-Bus object path does not exist, effecter ID: {EFFECTER_ID}",
-                "EFFECTER_ID", static_cast<uint16_t>(pdr->effecter_id));
-            continue;
+                "D-Bus object path does not exist for effecter ID '{EFFECTER_ID}', error - {ERROR}",
+                "EFFECTER_ID", static_cast<uint16_t>(pdr->effecter_id), "ERROR",
+                e);
         }
         dbusMappings.emplace_back(std::move(dbusMapping));
         pdr->effecter_id = handler.getNextEffecterId();
diff --git a/libpldmresponder/pdr_state_effecter.hpp b/libpldmresponder/pdr_state_effecter.hpp
index 17a7af9..4e3031a 100644
--- a/libpldmresponder/pdr_state_effecter.hpp
+++ b/libpldmresponder/pdr_state_effecter.hpp
@@ -43,7 +43,7 @@
             if (!statesSize)
             {
                 error(
-                    "Malformed PDR JSON return pdrEntry;- no state set info, TYPE={STATE_EFFECTER_PDR}",
+                    "Malformed PDR JSON return pdrEntry; no state set info for state effecter pdr '{STATE_EFFECTER_PDR}'",
                     "STATE_EFFECTER_PDR",
                     static_cast<unsigned>(PLDM_STATE_EFFECTER_PDR));
                 throw InternalFailure();
@@ -158,7 +158,7 @@
             catch (const std::exception& e)
             {
                 error(
-                    "Failed to create effecter PDR, D-Bus object '{PATH}' returned {ERROR}",
+                    "Failed to create effecter PDR, D-Bus object '{PATH}' returned error - {ERROR}",
                     "PATH", objectPath, "ERROR", e);
                 break;
             }
diff --git a/libpldmresponder/pdr_state_sensor.hpp b/libpldmresponder/pdr_state_sensor.hpp
index ea24497..dd9a992 100644
--- a/libpldmresponder/pdr_state_sensor.hpp
+++ b/libpldmresponder/pdr_state_sensor.hpp
@@ -42,7 +42,7 @@
             if (!statesSize)
             {
                 error(
-                    "Malformed PDR JSON return pdrEntry;- no state set info, TYPE={STATE_SENSOR_PDR}",
+                    "Malformed PDR JSON return pdrEntry; no state set info for state sensor pdr '{STATE_SENSOR_PDR}'",
                     "STATE_SENSOR_PDR",
                     static_cast<int>(PLDM_STATE_SENSOR_PDR));
                 throw InternalFailure();
@@ -169,7 +169,7 @@
             catch (const std::exception& e)
             {
                 error(
-                    "Failed to create sensor PDR, D-Bus object '{PATH}' returned {ERROR}",
+                    "Failed to create sensor PDR, D-Bus object '{PATH}' returned error - {ERROR}",
                     "PATH", objectPath, "ERROR", e);
                 break;
             }
diff --git a/libpldmresponder/pdr_utils.cpp b/libpldmresponder/pdr_utils.cpp
index e7f6d42..cfc776f 100644
--- a/libpldmresponder/pdr_utils.cpp
+++ b/libpldmresponder/pdr_utils.cpp
@@ -98,8 +98,9 @@
     if (dBusValues.size() != pv.size())
     {
         error(
-            "dBusValues size is not equal to pv size, dBusValues Size: {DBUS_VAL_SIZE}, pv Size: {PV_SIZE}",
-            "DBUS_VAL_SIZE", dBusValues.size(), "PV_SIZE", pv.size());
+            "DBusValues size '{DBUS_VALUE_SIZE}' is not equal to pv size'{PROPERTY_VALUE_SIZE}'.",
+            "DBUS_VALUE_SIZE", dBusValues.size(), "PROPERTY_VALUE_SIZE",
+            pv.size());
         return {};
     }
 
@@ -147,8 +148,7 @@
         }
         else
         {
-            error("Unknown D-Bus property type, TYPE={OTHER_TYPE}",
-                  "OTHER_TYPE", type.c_str());
+            error("Unknown D-Bus property type '{TYPE}'", "TYPE", type);
             return {};
         }
 
@@ -218,7 +218,8 @@
     // uint8_t(FRU Field Type), uint8_t(FRU Field Length)
     if (fruLen < fruRecordDataFormatLength)
     {
-        lg2::error("Invalid fru len: {FRULEN}", "FRULEN", fruLen);
+        error("Invalid FRU length '{LENGTH}' while parsing FRU record table",
+              "LENGTH", fruLen);
         return {};
     }
 
diff --git a/libpldmresponder/pdr_utils.hpp b/libpldmresponder/pdr_utils.hpp
index 44dfff3..01fe223 100644
--- a/libpldmresponder/pdr_utils.hpp
+++ b/libpldmresponder/pdr_utils.hpp
@@ -98,8 +98,7 @@
     std::ifstream jsonFile(path);
     if (!jsonFile.is_open())
     {
-        error("Error opening PDR JSON file, PATH={JSON_PATH}", "JSON_PATH",
-              path);
+        error("Error opening PDR JSON file at '{PATH}'", "PATH", path);
         return {};
     }
 
diff --git a/libpldmresponder/platform.cpp b/libpldmresponder/platform.cpp
index 2a19e66..be554dd 100644
--- a/libpldmresponder/platform.cpp
+++ b/libpldmresponder/platform.cpp
@@ -70,7 +70,8 @@
 {
     for (const auto& directory : dir)
     {
-        info("checking if : {DIR} exists", "DIR", directory);
+        info("Checking if directory '{DIRECTORY}' exists", "DIRECTORY",
+             directory);
         if (!fs::exists(directory))
         {
             return;
@@ -136,20 +137,22 @@
             catch (const InternalFailure& e)
             {
                 error(
-                    "PDR config directory '{PATH}' does not exist or empty for '{TYPE}' pdr: {ERROR}",
-                    "TYPE", pdrType, "PATH", dirEntry.path(), "ERROR", e);
+                    "PDR config directory '{PATH}' does not exist or empty for '{TYPE}' pdr, error - {ERROR}",
+                    "PATH", dirEntry.path(), "TYPE", pdrType, "ERROR", e);
             }
             catch (const Json::exception& e)
             {
-                error("Failed parsing PDR JSON file for '{TYPE}' pdr: {ERROR}",
-                      "TYPE", pdrType, "ERROR", e);
+                error(
+                    "Failed to parse PDR JSON file for '{TYPE}' pdr, error - {ERROR}",
+                    "TYPE", pdrType, "ERROR", e);
                 pldm::utils::reportError(
                     "xyz.openbmc_project.PLDM.Error.Generate.PDRJsonFileParseFail");
             }
             catch (const std::exception& e)
             {
-                error("Failed parsing PDR JSON file for '{TYPE}' pdr: {ERROR}",
-                      "TYPE", pdrType, "ERROR", e);
+                error(
+                    "Failed to parse PDR JSON file for '{TYPE}' pdr, error - {ERROR}",
+                    "TYPE", pdrType, "ERROR", e);
                 pldm::utils::reportError(
                     "xyz.openbmc_project.PLDM.Error.Generate.PDRJsonFileParseFail");
             }
@@ -269,8 +272,9 @@
     }
     catch (const std::exception& e)
     {
-        error("Error accessing PDR, HANDLE={REC_HANDLE} ERROR={ERR_EXCEP}",
-              "REC_HANDLE", recordHandle, "ERR_EXCEP", e.what());
+        error(
+            "Failed to access PDR record handle '{RECORD_HANDLE}', error - {ERROR}",
+            "RECORD_HANDLE", recordHandle, "ERROR", e);
         return CmdHandler::ccOnlyResponse(request, PLDM_ERROR);
     }
     return response;
@@ -387,7 +391,8 @@
         }
         catch (const std::out_of_range& e)
         {
-            error("Error in handling platform event msg: {ERROR}", "ERROR", e);
+            error("Failed to handle platform event msg, error - {ERROR}",
+                  "ERROR", e);
             return CmdHandler::ccOnlyResponse(request, PLDM_ERROR_INVALID_DATA);
         }
     }
@@ -683,8 +688,8 @@
     if (rc != PLDM_SUCCESS)
     {
         error(
-            "Reponse to GetNumericEffecterValue failed RC={RC} for EffectorId={EFFECTER_ID} ",
-            "RC", rc, "EFFECTER_ID", effecterId);
+            "Failed to get response of GetNumericEffecterValue for effecter ID '{EFFECTERID}', response code '{RC}'.",
+            "EFFECTERID", effecterId, "RC", rc);
         return ccOnlyResponse(request, rc);
     }
     return response;
@@ -872,9 +877,9 @@
         if (sensorRearmCount > tmpCompSensorCnt)
         {
             error(
-                "The requester sent wrong sensorRearm count for the sensor, SENSOR_ID={SENSOR_ID} SENSOR_REARM_COUNT={SENSOR_REARM_CNT}",
-                "SENSOR_ID", sensorId, "SENSOR_REARM_CNT",
-                (uint16_t)sensorRearmCount);
+                "The requester sent wrong sensor rearm count '{SENSOR_REARM_COUNT}' for the sensor ID '{SENSORID}'.",
+                "SENSOR_REARM_COUNT", (uint16_t)sensorRearmCount, "SENSORID",
+                sensorId);
             break;
         }
 
@@ -942,9 +947,9 @@
         if (compEffecterCnt > pdr->composite_effecter_count)
         {
             error(
-                "The requester sent wrong composite effecter count for the effecter, EFFECTER_ID={EFFECTER_ID} COMP_EFF_CNT={COMP_EFF_CNT}",
-                "EFFECTER_ID", effecterId, "COMP_EFF_CNT",
-                (uint16_t)compEffecterCnt);
+                "The requester sent wrong composite effecter count '{COMPOSITE_EFFECTER_COUNT}' for the effecter ID '{EFFECTERID}'.",
+                "COMPOSITE_EFFECTER_COUNT", (uint16_t)compEffecterCnt,
+                "EFFECTERID", effecterId);
             return false;
         }
 
@@ -984,8 +989,9 @@
     if (rc != PLDM_SUCCESS)
     {
         instanceIdDb->free(eid, instanceId);
-        error("Failed to encode_set_event_receiver_req, rc = {RC}", "RC",
-              lg2::hex, rc);
+        error(
+            "Failed to encode set event receiver request, response code '{RC}'",
+            "RC", lg2::hex, rc);
         return;
     }
 
@@ -1003,7 +1009,7 @@
         if (rc || completionCode)
         {
             error(
-                "Failed to decode setEventReceiver command response, rc = {RC}, cc = {CC}",
+                "Failed to decode setEventReceiver command, response code '{RC}' and completion code '{CC}'",
                 "RC", rc, "CC", (unsigned)completionCode);
             pldm::utils::reportError(
                 "xyz.openbmc_project.bmc.pldm.InternalFailure");
diff --git a/libpldmresponder/platform.hpp b/libpldmresponder/platform.hpp
index b50a1f4..ac07767 100644
--- a/libpldmresponder/platform.hpp
+++ b/libpldmresponder/platform.hpp
@@ -361,9 +361,9 @@
             if (compEffecterCnt > pdr->composite_effecter_count)
             {
                 error(
-                    "The requester sent wrong composite effecter count for the effecter, EFFECTER_ID={EFFECTER_ID} COMP_EFF_CNT={COMP_EFF_CNT}",
-                    "EFFECTER_ID", (unsigned)effecterId, "COMP_EFF_CNT",
-                    (unsigned)compEffecterCnt);
+                    "The requester sent wrong composite effecter count '{COMPOSITE_EFFECTER_COUNT}' for the effecter ID '{EFFECTERID}'.",
+                    "COMPOSITE_EFFECTER_COUNT", (unsigned)compEffecterCnt,
+                    "EFFECTERID", (unsigned)effecterId);
                 return PLDM_ERROR_INVALID_DATA;
             }
             break;
@@ -392,10 +392,10 @@
                     !(states->states[bitfieldIndex].byte & (1 << bit)))
                 {
                     error(
-                        "Invalid state set value, EFFECTER_ID={EFFECTER_ID} VALUE={EFFECTER_STATE} COMPOSITE_EFFECTER_ID={CURR_STATE} DBUS_PATH={DBUS_OBJ_PATH}",
-                        "EFFECTER_ID", (unsigned)effecterId, "EFFECTER_STATE",
+                        "Invalid state set value for effecter ID '{EFFECTERID}', effecter state '{EFFECTER_STATE}', composite effecter ID '{COMPOSITE_EFFECTER_ID}' and path '{PATH}'.",
+                        "EFFECTERID", (unsigned)effecterId, "EFFECTER_STATE",
                         (unsigned)stateField[currState].effecter_state,
-                        "CURR_STATE", (unsigned)currState, "DBUS_OBJ_PATH",
+                        "COMPOSITE_EFFECTER_COUNT", (unsigned)currState, "PATH",
                         dbusMappings[currState].objectPath.c_str());
                     rc = PLDM_PLATFORM_SET_EFFECTER_UNSUPPORTED_SENSORSTATE;
                     break;
@@ -416,11 +416,10 @@
                     catch (const std::exception& e)
                     {
                         error(
-                            "Error setting property, ERROR={ERR_EXCEP} PROPERTY={DBUS_PROP} INTERFACE={DBUS_INTF} PATH={DBUS_OBJ_PATH}",
-                            "ERR_EXCEP", e.what(), "DBUS_PROP",
-                            dbusMapping.propertyName, "DBUS_INTF",
+                            "Failed to set property '{PROPERTY}' of interface '{INTERFACE}' at path '{PATH}', error - {ERROR}",
+                            "PROPERTY", dbusMapping.propertyName, "DBUS_INTF",
                             dbusMapping.interface, "DBUS_OBJ_PATH",
-                            dbusMapping.objectPath.c_str());
+                            dbusMapping.objectPath.c_str(), "ERROR", e);
                         return PLDM_ERROR;
                     }
                 }
@@ -436,8 +435,8 @@
         catch (const std::out_of_range& e)
         {
             error(
-                "the effecterId does not exist. effecter id: {EFFECTER_ID} {ERR_EXCEP}",
-                "EFFECTER_ID", (unsigned)effecterId, "ERR_EXCEP", e.what());
+                "The effecter ID '{EFFECTERID}' does not exist, error - {ERROR}.",
+                "EFFECTERID", (unsigned)effecterId, "ERROR", e);
         }
 
         return rc;
diff --git a/libpldmresponder/platform_config.cpp b/libpldmresponder/platform_config.cpp
index 5c46199..8bc6b06 100644
--- a/libpldmresponder/platform_config.cpp
+++ b/libpldmresponder/platform_config.cpp
@@ -1,5 +1,9 @@
 #include "platform_config.hpp"
 
+#include <phosphor-logging/lg2.hpp>
+
+PHOSPHOR_LOG2_USING;
+
 namespace pldm
 {
 namespace responder
@@ -109,7 +113,7 @@
             catch (const std::exception& e)
             {
                 error(
-                    "Error getting Names property at '{PATH}' on '{INTERFACE}': {ERROR}",
+                    "Failed to get Names property at '{PATH}' on interface '{INTERFACE}', error - {ERROR}",
                     "PATH", objectPath, "INTERFACE", compatibleInterface,
                     "ERROR", e);
             }
@@ -117,8 +121,9 @@
     }
     catch (const std::exception& e)
     {
-        error("Failed to make a d-bus call to get platform name {ERROR}",
-              "ERROR", e);
+        error(
+            "Failed to make a d-bus call to get platform name, error - {ERROR}",
+            "ERROR", e);
     }
     return std::nullopt;
 }
diff --git a/libpldmresponder/platform_config.hpp b/libpldmresponder/platform_config.hpp
index 16e934c..b8a8b6e 100644
--- a/libpldmresponder/platform_config.hpp
+++ b/libpldmresponder/platform_config.hpp
@@ -2,10 +2,6 @@
 #include "common/utils.hpp"
 #include "pldmd/handler.hpp"
 
-#include <phosphor-logging/lg2.hpp>
-
-PHOSPHOR_LOG2_USING;
-
 namespace pldm
 {
 namespace responder
diff --git a/libpldmresponder/platform_numeric_effecter.hpp b/libpldmresponder/platform_numeric_effecter.hpp
index 44b5aab..1cad4a4 100644
--- a/libpldmresponder/platform_numeric_effecter.hpp
+++ b/libpldmresponder/platform_numeric_effecter.hpp
@@ -223,7 +223,7 @@
     }
     else
     {
-        error("Wrong field effecterDataSize...");
+        error("Unknown Effecter Size {SIZE}", "SIZE", effecterDataSize);
         return {PLDM_ERROR, {}};
     }
 }
@@ -295,7 +295,8 @@
 
     if (effecterValueLength != effecterValueArrayLength)
     {
-        error("effecter data size is incorrect.");
+        error("Incorrect effecter data size {SIZE}", "SIZE",
+              effecterValueLength);
         return PLDM_ERROR_INVALID_DATA;
     }
 
@@ -321,17 +322,17 @@
         catch (const std::exception& e)
         {
             error(
-                "Error setting property, ERROR={ERR_EXCEP} PROPERTY={DBUS_PROP} INTERFACE={DBUS_INTF} PATH={DBUS_OBJ_PATH}",
-                "ERR_EXCEP", e.what(), "DBUS_PROP", dbusMapping.propertyName,
-                "DBUS_INTF", dbusMapping.interface, "DBUS_OBJ_PATH",
-                dbusMapping.objectPath.c_str());
+                "Failed to set property '{PROPERTY}', interface '{INTERFACE}' and path '{PATH}', error - {ERROR}",
+                "PROPERTY", dbusMapping.propertyName, "INTERFACE",
+                dbusMapping.interface, "PATH", dbusMapping.objectPath.c_str(),
+                "ERROR", e);
             return PLDM_ERROR;
         }
     }
     catch (const std::out_of_range& e)
     {
-        error("Unknown effecter ID : {EFFECTER_ID} {ERR_EXCEP}", "EFFECTER_ID",
-              effecterId, "ERR_EXCEP", e.what());
+        error("Unknown effecter ID '{EFFECTERID}', error - {ERROR}",
+              "EFFECTERID", effecterId, "ERROR", e);
         return PLDM_ERROR;
     }
 
@@ -415,7 +416,7 @@
         }
         default:
         {
-            error("Unknown Effecter Size");
+            error("Unknown Effecter Size {SIZE}", "SIZE", effecterDataSize);
             return PLDM_ERROR;
         }
     }
@@ -467,8 +468,7 @@
     }
     else
     {
-        error("Property Type [{PROPERTYTYPE}] not supported", "PROPERTYTYPE",
-              propertyType);
+        error("Property type '{TYPE}' not supported", "TYPE", propertyType);
     }
     return PLDM_ERROR;
 }
@@ -529,8 +529,8 @@
 
     if (!pdr)
     {
-        error("The Numeric Effecter not found EFFECTERID={EFFECTERID}",
-              "EFFECTERID", effecterId);
+        error("Failed to find numeric effecter ID {EFFECTERID}", "EFFECTERID",
+              effecterId);
         return PLDM_PLATFORM_INVALID_EFFECTER_ID;
     }
 
@@ -555,11 +555,11 @@
     catch (const std::exception& e)
     {
         error(
-            "Dbus Mapping or the Dbus query for the Effecter failed for effecter id: {EFFECTER_ID}, {ERR_EXCEP}",
-            "EFFECTER_ID", effecterId, "ERR_EXCEP", e.what());
+            "Failed to do dbus mapping or the dbus query for the effecter ID '{EFFECTERID}', error - {ERROR}",
+            "EFFECTERID", effecterId, "ERROR", e);
         error(
-            "Dbus Details objPath : [{OBJ_PATH}] interface : [{INTF}], property : [{PROPERTY}]",
-            "OBJ_PATH", dbusMapping.objectPath.c_str(), "INTF",
+            "Dbus Details path [{PATH}], interface [{INTERFACE}] and  property [{PROPERTY}]",
+            "PATH", dbusMapping.objectPath.c_str(), "INTERFACE",
             dbusMapping.interface.c_str(), "PROPERTY",
             dbusMapping.propertyName.c_str());
         return PLDM_ERROR;
diff --git a/libpldmresponder/platform_state_effecter.hpp b/libpldmresponder/platform_state_effecter.hpp
index 247dbfd..a23732b 100644
--- a/libpldmresponder/platform_state_effecter.hpp
+++ b/libpldmresponder/platform_state_effecter.hpp
@@ -60,7 +60,7 @@
                   PLDM_STATE_EFFECTER_PDR);
     if (stateEffecterPDRs.empty())
     {
-        error("Failed to get record by PDR type");
+        error("Failed to get StateEffecterPDR record");
         return PLDM_PLATFORM_INVALID_EFFECTER_ID;
     }
 
@@ -81,8 +81,9 @@
         if (compEffecterCnt > pdr->composite_effecter_count)
         {
             error(
-                "The requester sent wrong composite effecter count for the effecter, EFFECTER_ID={EFFECTER_ID} COMP_EFF_CNT={COMP_EFF_CNT}",
-                "EFFECTER_ID", effecterId, "COMP_EFF_CNT", compEffecterCnt);
+                "The requester sent wrong composite effecter count '{COMPOSITE_EFFECTER_COUNT}' for the effecter ID '{EFFECTERID}'",
+                "EFFECTERID", effecterId, "COMPOSITE_EFFECTER_COUNT",
+                compEffecterCnt);
             return PLDM_ERROR_INVALID_DATA;
         }
         break;
@@ -100,7 +101,7 @@
                      dbusValMaps] = handler.getDbusObjMaps(effecterId);
         if (dbusMappings.empty() || dbusValMaps.empty())
         {
-            error("dbusMappings for effecter id : {EFFECTER_ID} is missing",
+            error("DbusMappings for effecter ID '{EFFECTER_ID}' is missing",
                   "EFFECTER_ID", effecterId);
             return PLDM_ERROR;
         }
@@ -118,13 +119,13 @@
             if (states->possible_states_size < bitfieldIndex ||
                 !(states->states[bitfieldIndex].byte & (1 << bit)))
             {
-                error(
-                    "Invalid state set value, EFFECTER_ID={EFFECTER_ID} VALUE={EFFECTER_STATE} COMPOSITE_EFFECTER_ID={CURR_STATE} DBUS_PATH={DBUS_OBJ_PATH}",
-                    "EFFECTER_ID", effecterId, "EFFECTER_STATE",
-                    stateField[currState].effecter_state, "CURR_STATE",
-                    currState, "DBUS_OBJ_PATH",
-                    dbusMappings[currState].objectPath.c_str());
                 rc = PLDM_PLATFORM_SET_EFFECTER_UNSUPPORTED_SENSORSTATE;
+                error(
+                    "Invalid state set value for effecter ID '{EFFECTER_ID}', effecter state '{EFFECTER_STATE}', composite effecter ID '{COMPOSITE_EFFECTER_ID}' and path '{PATH}', response code '{RC}'",
+                    "EFFECTER_ID", effecterId, "EFFECTER_STATE",
+                    stateField[currState].effecter_state,
+                    "COMPOSITE_EFFECTER_ID", currState, "PATH",
+                    dbusMappings[currState].objectPath.c_str(), "RC", rc);
                 break;
             }
             const DBusMapping& dbusMapping = dbusMappings[currState];
@@ -142,11 +143,10 @@
                 catch (const std::exception& e)
                 {
                     error(
-                        "Error setting property, ERROR={ERR_EXCEP} PROPERTY={DBUS_PROP} INTERFACE={DBUS_INTF} PATH={DBUS_OBJ_PATH}",
-                        "ERR_EXCEP", e.what(), "DBUS_PROP",
-                        dbusMapping.propertyName, "DBUS_INTF",
-                        dbusMapping.interface, "DBUS_OBJ_PATH",
-                        dbusMapping.objectPath.c_str());
+                        "Failed to set property '{PROPERTY}', interface '{INTERFACE}' and path '{PATH}', error - '{ERROR}'",
+                        "PROPERTY", dbusMapping.propertyName, "INTERFACE",
+                        dbusMapping.interface, "PATH",
+                        dbusMapping.objectPath.c_str(), "ERROR", e);
                     return PLDM_ERROR;
                 }
             }
@@ -161,8 +161,8 @@
     }
     catch (const std::out_of_range& e)
     {
-        error("Unknown effecter ID : {EFFECTER_ID} {ERR_EXCEP}", "EFFECTER_ID",
-              effecterId, "ERR_EXCEP", e.what());
+        error("Unknown effecter ID '{EFFECTERID}', error - {ERROR}",
+              "EFFECTERID", effecterId, "ERROR", e);
         return PLDM_ERROR;
     }
 
diff --git a/libpldmresponder/platform_state_sensor.hpp b/libpldmresponder/platform_state_sensor.hpp
index e6f7629..960f89d 100644
--- a/libpldmresponder/platform_state_sensor.hpp
+++ b/libpldmresponder/platform_state_sensor.hpp
@@ -54,9 +54,8 @@
     catch (const std::exception& e)
     {
         error(
-            "Get StateSensor EventState from dbus Error, interface : {DBUS_OBJ_PATH}, exception : {ERR_EXCEP}",
-            "DBUS_OBJ_PATH", dbusMapping.objectPath.c_str(), "ERR_EXCEP",
-            e.what());
+            "Failed to get state sensor event state from dbus interface '{PATH}', error - {ERROR}.",
+            "PATH", dbusMapping.objectPath.c_str(), "ERROR", e);
     }
 
     return PLDM_SENSOR_UNKNOWN;
@@ -101,7 +100,7 @@
     getRepoByType(handler.getRepo(), stateSensorPDRs, PLDM_STATE_SENSOR_PDR);
     if (stateSensorPDRs.empty())
     {
-        error("Failed to get record by PDR type");
+        error("Failed to get StateSensorPDR record.");
         return PLDM_PLATFORM_INVALID_SENSOR_ID;
     }
 
@@ -122,8 +121,8 @@
         if (sensorRearmCnt > compSensorCnt)
         {
             error(
-                "The requester sent wrong sensorRearm count for the sensor, SENSOR_ID={SENSOR_ID} SENSOR_REARM_COUNT={SENSOR_REARM_CNT}",
-                "SENSOR_ID", sensorId, "SENSOR_REARM_CNT", sensorRearmCnt);
+                "The requester sent wrong sensor rearm count '{SENSOR_REARM_COUNT}' for the sensor ID '{SENSORID}'",
+                "SENSORID", sensorId, "SENSOR_REARM_COUNT", sensorRearmCnt);
             return PLDM_PLATFORM_REARM_UNAVAILABLE_IN_PRESENT_STATE;
         }
 
@@ -149,7 +148,7 @@
 
         if (dbusMappings.empty() || dbusValMaps.empty())
         {
-            error("dbusMappings for sensor id : {SENSOR_ID} is missing",
+            error("DbusMappings for sensor ID '{SENSOR_ID}' is missing",
                   "SENSOR_ID", sensorId);
             return PLDM_ERROR;
         }
@@ -198,8 +197,8 @@
     }
     catch (const std::out_of_range& e)
     {
-        error("the sensorId does not exist. sensor id: {SENSOR_ID} {ERR_EXCEP}",
-              "SENSOR_ID", sensorId, "ERR_EXCEP", e.what());
+        error("The sensor ID '{SENSORID}' does not exist, error - {ERROR}",
+              "SENSORID", sensorId, "ERROR", e);
         rc = PLDM_ERROR;
     }