diff --git a/dbus-sdr/sdrutils.cpp b/dbus-sdr/sdrutils.cpp
index b8cf3fa..14eebb4 100644
--- a/dbus-sdr/sdrutils.cpp
+++ b/dbus-sdr/sdrutils.cpp
@@ -18,6 +18,7 @@
 
 #include <ipmid/utils.hpp>
 #include <nlohmann/json.hpp>
+#include <phosphor-logging/lg2.hpp>
 
 #include <fstream>
 #include <optional>
@@ -151,10 +152,8 @@
         }
         catch (const sdbusplus::exception_t& e)
         {
-            phosphor::logging::log<phosphor::logging::level::ERR>(
-                "fail to update subtree",
-                phosphor::logging::entry("PATH=%s", path),
-                phosphor::logging::entry("WHAT=%s", e.what()));
+            lg2::error("Failed to update subtree, path: {PATH}, error: {ERROR}",
+                       "PATH", path, "ERROR", e);
             return false;
         }
         if constexpr (debug)
@@ -429,10 +428,9 @@
     }
     catch (const std::exception& e)
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "Failed to GetAll", phosphor::logging::entry("PATH=%s", path),
-            phosphor::logging::entry("INTF=%s", interface),
-            phosphor::logging::entry("WHAT=%s", e.what()));
+        lg2::error("Failed to GetAll, path: {PATH}, interface: {INTERFACE}, "
+                   "error: {ERROR}",
+                   "PATH", path, "INTERFACE", interface, "ERROR", e);
     }
 
     return properties;
@@ -604,9 +602,8 @@
 
         if (!sensorInterfacesResponseOpt.has_value())
         {
-            phosphor::logging::log<phosphor::logging::level::DEBUG>(
-                "Failed to GetObject",
-                phosphor::logging::entry("PATH=%s", sensorConfigPath.c_str()));
+            lg2::debug("Failed to GetObject, path: {PATH}", "PATH",
+                       sensorConfigPath);
             continue;
         }
 
diff --git a/dbus-sdr/sensorcommands.cpp b/dbus-sdr/sensorcommands.cpp
index 3989ed2..6517fdd 100644
--- a/dbus-sdr/sensorcommands.cpp
+++ b/dbus-sdr/sensorcommands.cpp
@@ -28,7 +28,7 @@
 #include <ipmid/entity_map_json.hpp>
 #include <ipmid/types.hpp>
 #include <ipmid/utils.hpp>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
 #include <sdbusplus/bus.hpp>
 #include <user_channel/channel_layer.hpp>
 
@@ -218,15 +218,13 @@
         auto ptr = std::get_if<bool>(&(findAssert->second));
         if (ptr == nullptr)
         {
-            phosphor::logging::log<phosphor::logging::level::ERR>(
-                "thresholdChanged: Assert non bool");
+            lg2::error("thresholdChanged: Assert non bool");
             return;
         }
         if (*ptr)
         {
-            phosphor::logging::log<phosphor::logging::level::INFO>(
-                "thresholdChanged: Assert",
-                phosphor::logging::entry("SENSOR=%s", m.get_path()));
+            lg2::info("thresholdChanged: Assert, sensor path: {SENSOR_PATH}",
+                      "SENSOR_PATH", m.get_path());
             thresholdDeassertMap[m.get_path()][findAssert->first] = *ptr;
         }
         else
@@ -234,9 +232,9 @@
             auto& value = thresholdDeassertMap[m.get_path()][findAssert->first];
             if (value)
             {
-                phosphor::logging::log<phosphor::logging::level::INFO>(
-                    "thresholdChanged: deassert",
-                    phosphor::logging::entry("SENSOR=%s", m.get_path()));
+                lg2::info(
+                    "thresholdChanged: deassert, sensor path: {SENSOR_PATH}",
+                    "SENSOR_PATH", m.get_path());
                 value = *ptr;
             }
         }
@@ -380,10 +378,9 @@
 
         if (!found)
         {
-            phosphor::logging::log<phosphor::logging::level::ERR>(
-                "GetMangagedObjects for getSensorMap failed",
-                phosphor::logging::entry("SERVICE=%s",
-                                         sensorConnection.c_str()));
+            lg2::error("GetMangagedObjects for getSensorMap failed, "
+                       "service: {SERVICE}",
+                       "SERVICE", sensorConnection);
 
             return false;
         }
@@ -419,8 +416,7 @@
     if (supportedProperty == object.end() ||
         object.find("Selected") == object.end())
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "Missing the required Supported and Selected properties");
+        lg2::error("Missing the required Supported and Selected properties");
         return std::nullopt;
     }
 
@@ -429,8 +425,7 @@
 
     if (profilesPtr == nullptr)
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "property is not array of string");
+        lg2::error("property is not array of string");
         return std::nullopt;
     }
     return *profilesPtr;
@@ -454,11 +449,8 @@
     if (assertOffset == 0 || assertOffset == (1u << 15) ||
         (assertOffset & (assertOffset - 1)))
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "IPMI cmd format incorrect",
-
-            phosphor::logging::entry("BYTES=%#02x",
-                                     static_cast<uint16_t>(assertOffset)));
+        lg2::error("IPMI cmd format incorrect, bytes: {BYTES}", "BYTES",
+                   lg2::hex, static_cast<uint16_t>(assertOffset));
         return std::nullopt;
     }
 
@@ -470,8 +462,7 @@
 
     if (index >= profiles->size())
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "profile index out of boundary");
+        lg2::error("profile index out of boundary");
         return std::nullopt;
     }
 
@@ -485,8 +476,7 @@
 {
     if (valueObject.find("Value") == valueObject.end())
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "Missing the required Value property");
+        lg2::error("Missing the required Value property");
         return std::nullopt;
     }
 
@@ -569,20 +559,18 @@
                               "Selected", mode);
     if (ec)
     {
-        log<level::ERR>("Failed to get property",
-                        entry("PROPERTY=%s", "Selected"),
-                        entry("PATH=%s", path.c_str()),
-                        entry("INTERFACE=%s", sensor::sensorInterface),
-                        entry("WHAT=%s", ec.message().c_str()));
+        lg2::error("Failed to get Selected, path: {PATH}, "
+                   "interface: {INTERFACE}, error: {ERROR}",
+                   "PATH", path, "INTERFACE", sensor::sensorInterface, "ERROR",
+                   ec.message());
         return false;
     }
 
     auto itr = std::find(profiles->begin(), profiles->end(), mode);
     if (itr == profiles->end())
     {
-        using namespace phosphor::logging;
-        log<level::ERR>("VR mode doesn't match any of its profiles",
-                        entry("PATH=%s", path.c_str()));
+        lg2::error("VR mode doesn't match any of its profiles, path: {PATH}",
+                   "PATH", path);
         return false;
     }
     std::size_t index =
@@ -595,9 +583,9 @@
     }
     else
     {
-        log<level::ERR>("VR profile index reaches max assertion bit",
-                        entry("PATH=%s", path.c_str()),
-                        entry("INDEX=%uz", index));
+        lg2::error("VR profile index reaches max assertion bit, "
+                   "path: {PATH}, index: {INDEX}",
+                   "PATH", path, "INDEX", index);
         return false;
     }
     if constexpr (debug)
@@ -637,8 +625,7 @@
     ipmi::Cc ret = ipmi::storage::getFruSdrCount(ctx, fruCount);
     if (ret != ipmi::ccSuccess)
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "getOtherSensorsCount: getFruSdrCount error");
+        lg2::error("getOtherSensorsCount: getFruSdrCount error");
         return std::numeric_limits<size_t>::max();
     }
 
@@ -692,8 +679,7 @@
         size_t type12Index = sdrIndex - fruCount;
         if (type12Index >= ipmi::storage::type12Count)
         {
-            phosphor::logging::log<phosphor::logging::level::ERR>(
-                "getSensorDataRecord: type12Index error");
+            lg2::error("getSensorDataRecord: type12Index error");
             return GENERAL_ERROR;
         }
         recordData = ipmi::storage::getType12SDRs(type12Index, recordID);
@@ -738,9 +724,8 @@
 
     if (ipmi::getChannelInfo(ctx->channel, chInfo) != ipmi::ccSuccess)
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "Failed to get Channel Info",
-            phosphor::logging::entry("CHANNEL=%d", ctx->channel));
+        lg2::error("Failed to get Channel Info, channel: {CHANNEL}", "CHANNEL",
+                   ctx->channel);
         return ipmi::responseUnspecifiedError();
     }
 
@@ -837,11 +822,10 @@
 
         if constexpr (debug)
         {
-            phosphor::logging::log<phosphor::logging::level::INFO>(
-                "IPMI SET_SENSOR",
-                phosphor::logging::entry("SENSOR_NUM=%d", sensorNumber),
-                phosphor::logging::entry("BYTE=%u", (unsigned int)reading),
-                phosphor::logging::entry("VALUE=%f", *value));
+            lg2::info("IPMI SET_SENSOR, sensor number: {SENSOR_NUM}, "
+                      "byte: {BYTE}, value: {VALUE}",
+                      "SENSOR_NUM", sensorNumber, "BYTE", (unsigned int)reading,
+                      "VALUE", *value);
         }
 
         boost::system::error_code ec =
@@ -853,12 +837,10 @@
         // callback functions for now (e.g. ipmiSetSensorReading).
         if (ec)
         {
-            using namespace phosphor::logging;
-            log<level::ERR>("Failed to set property",
-                            entry("PROPERTY=%s", "Value"),
-                            entry("PATH=%s", path.c_str()),
-                            entry("INTERFACE=%s", sensor::sensorInterface),
-                            entry("WHAT=%s", ec.message().c_str()));
+            lg2::error("Failed to set Value, path: {PATH}, "
+                       "interface: {INTERFACE}, ERROR: {ERROR}",
+                       "PATH", path, "INTERFACE", sensor::sensorInterface,
+                       "ERROR", ec.message());
             return ipmi::responseResponseError();
         }
         return ipmi::responseSuccess();
@@ -894,20 +876,15 @@
         // callback functions for now (e.g. ipmiSetSensorReading).
         if (ec)
         {
-            using namespace phosphor::logging;
-            log<level::ERR>("Failed to set property",
-                            entry("PROPERTY=%s", "Selected"),
-                            entry("PATH=%s", path.c_str()),
-                            entry("INTERFACE=%s", sensor::sensorInterface),
-                            entry("WHAT=%s", ec.message().c_str()));
-            return ipmi::responseResponseError();
+            lg2::error("Failed to set Selected, path: {PATH}, "
+                       "interface: {INTERFACE}, ERROR: {ERROR}",
+                       "PATH", path, "INTERFACE", sensor::sensorInterface,
+                       "ERROR", ec.message());
         }
         return ipmi::responseSuccess();
     }
 
-    phosphor::logging::log<phosphor::logging::level::ERR>(
-        "unknown sensor type",
-        phosphor::logging::entry("PATH=%s", path.c_str()));
+    lg2::error("unknown sensor type, path: {PATH}", "PATH", path);
     return ipmi::responseResponseError();
 }
 
@@ -1626,9 +1603,9 @@
     auto status = getSensorConnection(ctx, sensorNum, connection, path);
     if (status)
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "ipmiSenGetSensorEventStatus: Sensor connection Error",
-            phosphor::logging::entry("SENSOR=%d", sensorNum));
+        lg2::error("ipmiSenGetSensorEventStatus: Sensor connection Error, "
+                   "sensor number: {SENSOR_NUM}",
+                   "SENSOR_NUM", sensorNum);
         return ipmi::response(status);
     }
 
@@ -1669,9 +1646,9 @@
     DbusInterfaceMap sensorMap;
     if (!getSensorMap(ctx, connection, path, sensorMap))
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "ipmiSenGetSensorEventStatus: Sensor Mapping Error",
-            phosphor::logging::entry("SENSOR=%s", path.c_str()));
+        lg2::error("ipmiSenGetSensorEventStatus: Sensor Mapping Error, "
+                   "sensor path: {SENSOR_PATH}",
+                   "SENSOR_PATH", path);
         return ipmi::responseResponseError();
     }
 
@@ -1828,10 +1805,9 @@
     DbusInterfaceMap sensorMap;
     if (!getSensorMap(ctx, service, path, sensorMap, sensorMapSdrUpdatePeriod))
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "Failed to update sensor map for threshold sensor",
-            phosphor::logging::entry("SERVICE=%s", service.c_str()),
-            phosphor::logging::entry("PATH=%s", path.c_str()));
+        lg2::error("Failed to update sensor map for threshold sensor, "
+                   "service: {SERVICE}, path: {PATH}",
+                   "SERVICE", service, "PATH", path);
         return false;
     }
 
@@ -1851,8 +1827,7 @@
     auto sensorObject = sensorMap.find(sensor::sensorInterface);
     if (sensorObject == sensorMap.end())
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "constructSensorSdr: sensorObject error");
+        lg2::error("constructSensorSdr: sensorObject error");
         return false;
     }
 
@@ -1879,8 +1854,7 @@
 
     if (!getSensorAttributes(max, min, mValue, rExp, bValue, bExp, bSigned))
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "constructSensorSdr: getSensorAttributes error");
+        lg2::error("constructSensorSdr: getSensorAttributes error");
         return false;
     }
 
@@ -1964,8 +1938,7 @@
     }
     catch (const std::exception&)
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "constructSensorSdr: getIPMIThresholds error");
+        lg2::error("constructSensorSdr: getIPMIThresholds error");
         return false;
     }
 
@@ -2099,10 +2072,9 @@
     DbusInterfaceMap sensorMap;
     if (!getSensorMap(ctx, service, path, sensorMap, sensorMapSdrUpdatePeriod))
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "Failed to update sensor map for VR sensor",
-            phosphor::logging::entry("SERVICE=%s", service.c_str()),
-            phosphor::logging::entry("PATH=%s", path.c_str()));
+        lg2::error("Failed to update sensor map for VR sensor, "
+                   "service: {SERVICE}, path: {PATH}",
+                   "SERVICE", service, "PATH", path);
         return false;
     }
     // follow the association chain to get the parent board's entityid and
@@ -2162,8 +2134,7 @@
     }
     if (recordID > lastRecord)
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "getSensorDataRecord: recordID > lastRecord error");
+        lg2::error("getSensorDataRecord: recordID > lastRecord error");
         return GENERAL_ERROR;
     }
     if (recordID >= ipmi::getNumberOfSensors())
@@ -2172,8 +2143,6 @@
                                                                recordData);
             err < 0)
         {
-            // phosphor::logging::log<phosphor::logging::level::ERR>(
-            //     "getSensorDataRecord: Error getting custom record");
             return lastRecordIndex;
         }
         return nextRecord;
@@ -2209,8 +2178,7 @@
                                       connection, path, &interfaces);
     if (status)
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "getSensorDataRecord: getSensorConnection error");
+        lg2::error("getSensorDataRecord: getSensorConnection error");
         return GENERAL_ERROR;
     }
     uint16_t sensorNum = getSensorNumberFromPath(path);
@@ -2219,8 +2187,7 @@
     if (((sensorNum > lun1MaxSensorNum) && (sensorNum <= maxIPMISensors)) ||
         (sensorNum > lun3MaxSensorNum))
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "getSensorDataRecord: invalidSensorNumber");
+        lg2::error("getSensorDataRecord: invalidSensorNumber");
         return GENERAL_ERROR;
     }
     uint8_t sensornumber = static_cast<uint8_t>(sensorNum);
@@ -2229,8 +2196,7 @@
     if ((sensornumber != static_cast<uint8_t>(sensNumFromRecID)) &&
         (lun != ctx->lun))
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "getSensorDataRecord: sensor record mismatch");
+        lg2::error("getSensorDataRecord: sensor record mismatch");
         return GENERAL_ERROR;
     }
 
@@ -2538,16 +2504,14 @@
     // record
     if ((sdrReservationID == 0 || reservationID != sdrReservationID) && offset)
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "ipmiStorageGetSDR: responseInvalidReservationId");
+        lg2::error("ipmiStorageGetSDR: responseInvalidReservationId");
         return ipmi::responseInvalidReservationId();
     }
 
     auto& sensorTree = getSensorTree();
     if (!getSensorSubtree(sensorTree) && sensorTree.empty())
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "ipmiStorageGetSDR: getSensorSubtree error");
+        lg2::error("ipmiStorageGetSDR: getSensorSubtree error");
         return ipmi::responseResponseError();
     }
 
@@ -2560,16 +2524,14 @@
 
     if (nextRecordId < 0)
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "ipmiStorageGetSDR: fail to get SDR");
+        lg2::error("ipmiStorageGetSDR: fail to get SDR");
         return ipmi::responseInvalidFieldRequest();
     }
     get_sdr::SensorDataRecordHeader* hdr =
         reinterpret_cast<get_sdr::SensorDataRecordHeader*>(record.data());
     if (!hdr)
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "ipmiStorageGetSDR: record header is null");
+        lg2::error("ipmiStorageGetSDR: record header is null");
         return ipmi::responseSuccess(nextRecordId, record);
     }
 
@@ -2577,8 +2539,7 @@
                        hdr->record_length;
     if (offset >= sdrLength)
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "ipmiStorageGetSDR: offset is outside the record");
+        lg2::error("ipmiStorageGetSDR: offset is outside the record");
         return ipmi::responseParmOutOfRange();
     }
     if (sdrLength < (offset + bytesToRead))
@@ -2589,8 +2550,7 @@
     uint8_t* respStart = reinterpret_cast<uint8_t*>(hdr) + offset;
     if (!respStart)
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "ipmiStorageGetSDR: record is null");
+        lg2::error("ipmiStorageGetSDR: record is null");
         return ipmi::responseSuccess(nextRecordId, record);
     }
 
@@ -2646,10 +2606,9 @@
         if (!getSensorMap(ctx, connection, sensorObjPath, sensorMap,
                           sensorMapSdrUpdatePeriod))
         {
-            phosphor::logging::log<phosphor::logging::level::ERR>(
-                "Failed to update sensor map for threshold sensor",
-                phosphor::logging::entry("SERVICE=%s", connection.c_str()),
-                phosphor::logging::entry("PATH=%s", sensorObjPath.c_str()));
+            lg2::error("Failed to update sensor map for threshold sensor, "
+                       "service: {SERVICE}, path: {PATH}",
+                       "SERVICE", connection, "PATH", sensorObjPath);
             continue;
         }
 
@@ -2710,11 +2669,9 @@
     }
     if (invalidSensorNumberErrCount != 0)
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            std::format(
-                "getSensorNumberFromPath returned invalidSensorNumber {} times",
-                invalidSensorNumberErrCount)
-                .data());
+        lg2::error("getSensorNumberFromPath returned invalidSensorNumber "
+                   "{ERR_COUNT} times",
+                   "ERR_COUNT", invalidSensorNumberErrCount);
     }
 
     auto cmpFunc = [](sensorInfo first, sensorInfo second) {
@@ -2785,15 +2742,15 @@
     auto match = ipmi::dcmi::validEntityId.find(entityId);
     if (match == ipmi::dcmi::validEntityId.end())
     {
-        log<level::ERR>("Unknown Entity ID", entry("ENTITY_ID=%d", entityId));
+        lg2::error("Unknown Entity ID: {ENTITY_ID}", "ENTITY_ID", entityId);
 
         return ipmi::responseInvalidFieldRequest();
     }
 
     if (sensorType != ipmi::dcmi::temperatureSensorType)
     {
-        log<level::ERR>("Invalid sensor type",
-                        entry("SENSOR_TYPE=%d", sensorType));
+        lg2::error("Invalid sensor type: {SENSOR_TYPE}", "SENSOR_TYPE",
+                   sensorType);
 
         return ipmi::responseInvalidFieldRequest();
     }
@@ -2842,15 +2799,15 @@
     auto match = ipmi::dcmi::validEntityId.find(entityId);
     if (match == ipmi::dcmi::validEntityId.end())
     {
-        log<level::ERR>("Unknown Entity ID", entry("ENTITY_ID=%d", entityId));
+        lg2::error("Unknown Entity ID: {ENTITY_ID}", "ENTITY_ID", entityId);
 
         return ipmi::responseInvalidFieldRequest();
     }
 
     if (sensorType != ipmi::dcmi::temperatureSensorType)
     {
-        log<level::ERR>("Invalid sensor type",
-                        entry("SENSOR_TYPE=%d", sensorType));
+        lg2::error("Invalid sensor type: {SENSOR_TYPE}", "SENSOR_TYPE",
+                   sensorType);
 
         return ipmi::responseInvalidFieldRequest();
     }
diff --git a/dbus-sdr/storagecommands.cpp b/dbus-sdr/storagecommands.cpp
index c77189a..afe3535 100644
--- a/dbus-sdr/storagecommands.cpp
+++ b/dbus-sdr/storagecommands.cpp
@@ -25,7 +25,7 @@
 #include <ipmid/api.hpp>
 #include <ipmid/message.hpp>
 #include <ipmid/types.hpp>
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
 #include <sdbusplus/message/types.hpp>
 #include <sdbusplus/timer.hpp>
 
@@ -133,8 +133,7 @@
     catch (const sdbusplus::exception_t&)
     {
         // todo: log sel?
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "error writing fru");
+        lg2::error("error writing fru");
         return false;
     }
     writeBus = invalidBus;
@@ -171,9 +170,8 @@
         if (busFind == fruIface->second.end() ||
             addrFind == fruIface->second.end())
         {
-            phosphor::logging::log<phosphor::logging::level::INFO>(
-                "fru device missing Bus or Address",
-                phosphor::logging::entry("FRU=%s", fru.first.str.c_str()));
+            lg2::info("fru device missing Bus or Address, fru: {FRU}", "FRU",
+                      fru.first.str);
             continue;
         }
 
@@ -230,9 +228,8 @@
         "org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
     if (ec)
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "GetMangagedObjects for replaceCacheFru failed",
-            phosphor::logging::entry("ERROR=%s", ec.message().c_str()));
+        lg2::error("GetMangagedObjects for replaceCacheFru failed: {ERROR}",
+                   "ERROR", ec.message());
 
         return;
     }
@@ -266,9 +263,7 @@
             cacheAddr);
     if (ec)
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "Couldn't get raw fru",
-            phosphor::logging::entry("ERROR=%s", ec.message().c_str()));
+        lg2::error("Couldn't get raw fru: {ERROR}", "ERROR", ec.message());
 
         cacheBus = invalidBus;
         cacheAddr = invalidAddr;
@@ -608,9 +603,9 @@
 
     if (ec)
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "GetMangagedObjects for ipmiStorageGetFruInvAreaInfo failed",
-            phosphor::logging::entry("ERROR=%s", ec.message().c_str()));
+        lg2::error("GetMangagedObjects for ipmiStorageGetFruInvAreaInfo "
+                   "failed: {ERROR}",
+                   "ERROR", ec.message());
 
         return ipmi::ccResponseError;
     }
@@ -847,12 +842,12 @@
         }
         catch (const std::invalid_argument& e)
         {
-            phosphor::logging::log<phosphor::logging::level::ERR>(e.what());
+            lg2::error("Invalid argument: {ERROR}", "ERROR", e);
             return -1;
         }
         catch (const std::out_of_range& e)
         {
-            phosphor::logging::log<phosphor::logging::level::ERR>(e.what());
+            lg2::error("Out of range: {ERROR}", "ERROR", e);
             return -1;
         }
     }
