diff --git a/apphandler.cpp b/apphandler.cpp
index 6d57345..c7b1c37 100644
--- a/apphandler.cpp
+++ b/apphandler.cpp
@@ -21,7 +21,7 @@
 #include <ipmid/utils.hpp>
 #include <nlohmann/json.hpp>
 #include <phosphor-logging/elog-errors.hpp>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
 #include <sdbusplus/message/types.hpp>
 #include <sys_info_param.hpp>
 #include <xyz/openbmc_project/Common/error.hpp>
@@ -119,9 +119,9 @@
     }
     catch (const sdbusplus::exception_t& e)
     {
-        log<level::ERR>("Failed to fetch redundancy object from dbus",
-                        entry("INTERFACE=%s", redundancyIntf),
-                        entry("ERRMSG=%s", e.what()));
+        lg2::error("Failed to fetch redundancy object from dbus, "
+                   "interface: {INTERFACE},  error: {ERROR}",
+                   "INTERFACE", redundancyIntf, "ERROR", e);
         elog<InternalFailure>();
     }
 
@@ -165,14 +165,14 @@
             }
             catch (const std::exception& e)
             {
-                log<level::ERR>(e.what());
+                lg2::error("error message: {ERROR}", "ERROR", e);
             }
         }
     }
 
     if (!objectFound)
     {
-        log<level::ERR>("Could not found an BMC software Object");
+        lg2::error("Could not found an BMC software Object");
         elog<InternalFailure>();
     }
 
@@ -326,15 +326,14 @@
         if (!acpi_state::isValidACPIState(
                 acpi_state::PowerStateType::sysPowerState, s))
         {
-            log<level::ERR>("set_acpi_power sys invalid input",
-                            entry("S=%x", s));
+            lg2::error("set_acpi_power sys invalid input, S: {S}", "S", s);
             return ipmi::responseParmOutOfRange();
         }
 
         // valid input
         if (s == static_cast<uint8_t>(acpi_state::PowerState::noChange))
         {
-            log<level::DEBUG>("No change for system power state");
+            lg2::debug("No change for system power state");
         }
         else
         {
@@ -357,15 +356,15 @@
             }
             catch (const InternalFailure& e)
             {
-                log<level::ERR>("Failed in set ACPI system property",
-                                entry("EXCEPTION=%s", e.what()));
+                lg2::error("Failed in set ACPI system property: {ERROR}",
+                           "ERROR", e);
                 return ipmi::responseUnspecifiedError();
             }
         }
     }
     else
     {
-        log<level::DEBUG>("Do not change system power state");
+        lg2::debug("Do not change system power state");
     }
 
     if (devAcpiState & acpi_state::stateChanged)
@@ -375,15 +374,14 @@
         if (!acpi_state::isValidACPIState(
                 acpi_state::PowerStateType::devPowerState, s))
         {
-            log<level::ERR>("set_acpi_power dev invalid input",
-                            entry("S=%x", s));
+            lg2::error("set_acpi_power dev invalid input, S: {S}", "S", s);
             return ipmi::responseParmOutOfRange();
         }
 
         // valid input
         if (s == static_cast<uint8_t>(acpi_state::PowerState::noChange))
         {
-            log<level::DEBUG>("No change for device power state");
+            lg2::debug("No change for device power state");
         }
         else
         {
@@ -406,15 +404,15 @@
             }
             catch (const InternalFailure& e)
             {
-                log<level::ERR>("Failed in set ACPI device property",
-                                entry("EXCEPTION=%s", e.what()));
+                lg2::error("Failed in set ACPI device property: {ERROR}",
+                           "ERROR", e);
                 return ipmi::responseUnspecifiedError();
             }
         }
     }
     else
     {
-        log<level::DEBUG>("Do not change device power state");
+        lg2::debug("Do not change device power state");
     }
     return ipmi::responseSuccess();
 }
@@ -645,7 +643,7 @@
         }
         catch (const std::exception& e)
         {
-            log<level::ERR>(e.what());
+            lg2::error("error message: {ERROR}", "ERROR", e);
         }
 
         if (r >= 0)
@@ -710,13 +708,13 @@
             }
             else
             {
-                log<level::ERR>("Device ID JSON parser failure");
+                lg2::error("Device ID JSON parser failure");
                 return ipmi::responseUnspecifiedError();
             }
         }
         else
         {
-            log<level::ERR>("Device ID file not found");
+            lg2::error("Device ID file not found");
             return ipmi::responseUnspecifiedError();
         }
     }
@@ -858,10 +856,9 @@
                                                        objectInfo);
     if (ec.value())
     {
-        log<level::ERR>("Failed to locate System UUID object",
-                        entry("INTERFACE=%s", uuidInterface),
-                        entry("ERROR=%s", ec.message().c_str()));
-        return ipmi::responseUnspecifiedError();
+        lg2::error("Failed to locate System UUID object, "
+                   "interface: {INTERFACE}, error: {ERROR}",
+                   "INTERFACE", uuidInterface, "ERROR", ec.message());
     }
 
     // Read UUID property value from bmcObject
@@ -871,10 +868,11 @@
                                uuidInterface, uuidProperty, rfc4122Uuid);
     if (ec.value())
     {
-        log<level::ERR>("Failed in reading BMC UUID property",
-                        entry("INTERFACE=%s", uuidInterface),
-                        entry("PROPERTY=%s", uuidProperty),
-                        entry("ERROR=%s", ec.message().c_str()));
+        lg2::error("Failed to read System UUID property, "
+                   "interface: {INTERFACE}, property: {PROPERTY}, "
+                   "error: {ERROR}",
+                   "INTERFACE", uuidInterface, "PROPERTY", uuidProperty,
+                   "ERROR", ec.message());
         return ipmi::responseUnspecifiedError();
     }
     std::array<uint8_t, 16> uuid;
@@ -885,10 +883,11 @@
     }
     catch (const InvalidArgument& e)
     {
-        log<level::ERR>("Failed in parsing BMC UUID property",
-                        entry("INTERFACE=%s", uuidInterface),
-                        entry("PROPERTY=%s", uuidProperty),
-                        entry("VALUE=%s", rfc4122Uuid.c_str()));
+        lg2::error("Failed in parsing BMC UUID property, "
+                   "interface: {INTERFACE}, property: {PROPERTY}, "
+                   "value: {VALUE}, error: {ERROR}",
+                   "INTERFACE", uuidInterface, "PROPERTY", uuidProperty,
+                   "VALUE", rfc4122Uuid, "ERROR", e);
         return ipmi::responseUnspecifiedError();
     }
     return ipmi::responseSuccess(uuid);
@@ -925,10 +924,11 @@
     }
     catch (const std::exception& e)
     {
-        log<level::ERR>("Failed in getting session state property",
-                        entry("service=%s", service.c_str()),
-                        entry("object path=%s", obj.c_str()),
-                        entry("interface=%s", session::sessionIntf));
+        lg2::error("Failed in getting session state property, "
+                   "service: {SERVICE}, object path: {OBJECT_PATH}, "
+                   "interface: {INTERFACE}, error: {ERROR}",
+                   "SERVICE", service, "OBJECT_PATH", obj, "INTERFACE",
+                   session::sessionIntf, "ERROR", e);
         return ipmi::ccUnspecifiedError;
     }
 
@@ -991,9 +991,9 @@
     }
     catch (const sdbusplus::exception_t& e)
     {
-        log<level::ERR>("Failed to fetch object from dbus",
-                        entry("INTERFACE=%s", session::sessionIntf),
-                        entry("ERRMSG=%s", e.what()));
+        lg2::error("Failed to fetch object from dbus, "
+                   "interface: {INTERFACE}, error: {ERROR}",
+                   "INTERFACE", session::sessionIntf, "ERROR", e);
         return ipmi::responseUnspecifiedError();
     }
 
@@ -1117,11 +1117,11 @@
         ctx, service, objPath, session::sessionIntf, "State", sessionState);
     if (ec)
     {
-        log<level::ERR>("Failed to fetch state property ",
-                        entry("SERVICE=%s", service.c_str()),
-                        entry("OBJECTPATH=%s", objPath.c_str()),
-                        entry("INTERFACE=%s", session::sessionIntf),
-                        entry("ERRMSG=%s", ec.message().c_str()));
+        lg2::error("Failed to fetch state property, service: {SERVICE}, "
+                   "object path: {OBJECTPATH}, interface: {INTERFACE}, "
+                   "error: {ERROR}",
+                   "SERVICE", service, "OBJECTPATH", objPath, "INTERFACE",
+                   session::sessionIntf, "ERROR", ec.message());
         return ipmi::ccUnspecifiedError;
     }
     return ipmi::ccSuccess;
@@ -1166,11 +1166,11 @@
 
     if (ec)
     {
-        log<level::ERR>("Failed to fetch state property ",
-                        entry("SERVICE=%s", service.c_str()),
-                        entry("OBJECTPATH=%s", objPath.c_str()),
-                        entry("INTERFACE=%s", session::sessionIntf),
-                        entry("ERRMSG=%s", ec.message().c_str()));
+        lg2::error("Failed to fetch state property, service: {SERVICE}, "
+                   "object path: {OBJECTPATH}, interface: {INTERFACE}, "
+                   "error: {ERROR}",
+                   "SERVICE", service, "OBJECTPATH", objPath, "INTERFACE",
+                   session::sessionIntf, "ERROR", ec.message());
         return ipmi::ccUnspecifiedError;
     }
 
@@ -1224,9 +1224,9 @@
         ctx, session::sessionManagerRootPath, session::sessionIntf, objectTree);
     if (ec)
     {
-        log<level::ERR>("Failed to fetch object from dbus",
-                        entry("INTERFACE=%s", session::sessionIntf),
-                        entry("ERRMSG=%s", ec.message().c_str()));
+        lg2::error("Failed to fetch object from dbus, "
+                   "interface: {INTERFACE}, error: {ERROR}",
+                   "INTERFACE", session::sessionIntf, "ERROR", ec.message());
         return ipmi::responseUnspecifiedError();
     }
 
@@ -1451,8 +1451,7 @@
         // only following 2 states are supported
         if (data1 > setInProgress)
         {
-            phosphor::logging::log<phosphor::logging::level::ERR>(
-                "illegal SetInProgress status");
+            lg2::error("illegal SetInProgress status");
             return ipmi::responseInvalidFieldRequest();
         }
 
@@ -1546,9 +1545,8 @@
 
     if (!jsonFile.good())
     {
-        log<level::WARNING>(
-            "i2c allow list file not found!",
-            entry("FILE_NAME: %s", i2cControllerWRAllowlistFile));
+        lg2::warning("i2c allow list file not found! file name: {FILE_NAME}",
+                     "FILE_NAME", i2cControllerWRAllowlistFile);
         return false;
     }
 
@@ -1558,9 +1556,9 @@
     }
     catch (const nlohmann::json::parse_error& e)
     {
-        log<level::ERR>("Corrupted i2c allow list config file",
-                        entry("FILE_NAME: %s", i2cControllerWRAllowlistFile),
-                        entry("MSG: %s", e.what()));
+        lg2::error("Corrupted i2c allow list config file, "
+                   "file name: {FILE_NAME}, error: {ERROR}",
+                   "FILE_NAME", i2cControllerWRAllowlistFile, "ERROR", e);
         return false;
     }
 
@@ -1594,9 +1592,10 @@
             nlohmann::json filter = it.value();
             if (filter.is_null())
             {
-                log<level::ERR>(
-                    "Corrupted I2C controller write read allowlist config file",
-                    entry("FILE_NAME: %s", i2cControllerWRAllowlistFile));
+                lg2::error(
+                    "Corrupted I2C controller write read allowlist config file, "
+                    "file name: {FILE_NAME}",
+                    "FILE_NAME", i2cControllerWRAllowlistFile);
                 return false;
             }
             const std::vector<uint8_t>& writeData =
@@ -1605,8 +1604,8 @@
                 convertStringToData(filter[cmdMaskStr].get<std::string>());
             if (writeDataMask.size() != writeData.size())
             {
-                log<level::ERR>("I2C controller write read allowlist filter "
-                                "mismatch for command & mask size");
+                lg2::error("I2C controller write read allowlist filter "
+                           "mismatch for command & mask size");
                 return false;
             }
             allowlist.push_back(
@@ -1622,16 +1621,16 @@
         }
         if (allowlist.size() != filters.size())
         {
-            log<level::ERR>(
+            lg2::error(
                 "I2C controller write read allowlist filter size mismatch");
             return false;
         }
     }
     catch (const std::exception& e)
     {
-        log<level::ERR>(
-            "I2C controller write read allowlist unexpected exception",
-            entry("ERROR=%s", e.what()));
+        lg2::error("I2C controller write read allowlist "
+                   "unexpected exception: {ERROR}",
+                   "ERROR", e);
         return false;
     }
     return true;
@@ -1679,8 +1678,7 @@
 #else
 static bool populateI2CControllerWRAllowlist()
 {
-    log<level::INFO>(
-        "I2C_WHITELIST_CHECK is disabled, do not populate allowlist");
+    lg2::info("I2C_WHITELIST_CHECK is disabled, do not populate allowlist");
     return true;
 }
 #endif // ENABLE_I2C_WHITELIST_CHECK
@@ -1711,18 +1709,17 @@
     const size_t writeCount = writeData.size();
     if (!readCount && !writeCount)
     {
-        log<level::ERR>(
-            "Controller write read command: Read & write count are 0");
+        lg2::error("Controller write read command: Read & write count are 0");
         return ipmi::responseInvalidFieldRequest();
     }
 #ifdef ENABLE_I2C_WHITELIST_CHECK
     if (!isCmdAllowlisted(static_cast<uint8_t>(busId),
                           static_cast<uint8_t>(targetAddr), writeData))
     {
-        log<level::ERR>("Controller write read request blocked!",
-                        entry("BUS=%d", static_cast<uint8_t>(busId)),
-                        entry("ADDR=0x%x", static_cast<uint8_t>(targetAddr)));
-        return ipmi::responseInvalidFieldRequest();
+        lg2::error("Controller write read request blocked!, "
+                   "bus: {BUS}, addr: {ADDR}",
+                   "BUS", static_cast<uint8_t>(busId), "ADDR", lg2::hex,
+                   static_cast<uint8_t>(targetAddr));
     }
 #endif // ENABLE_I2C_WHITELIST_CHECK
     std::vector<uint8_t> readBuf(readCount);
