oem-ibm: 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: I24ca21de35d5a1a9b3cc64b28a149e4c213055f9
Signed-off-by: Riya Dixit <riyadixitagra@gmail.com>
diff --git a/oem/ibm/libpldmresponder/file_io.cpp b/oem/ibm/libpldmresponder/file_io.cpp
index 5d394e3..adce4ec 100644
--- a/oem/ibm/libpldmresponder/file_io.cpp
+++ b/oem/ibm/libpldmresponder/file_io.cpp
@@ -69,7 +69,7 @@
{
rc = -errno;
error(
- "transferHostDataToSocket: Failed to open the XDMA device, RC={RC}",
+ "Failed to open the XDMA device for transferring remote terminus data to socket with response code '{RC}'",
"RC", rc);
return rc;
}
@@ -83,7 +83,7 @@
{
rc = -errno;
error(
- "transferHostDataToSocket : Failed to mmap the XDMA device, RC={RC}",
+ "Failed to mmap the XDMA device for transferring remote terminus data to socket with response code '{RC}'",
"RC", rc);
return rc;
}
@@ -100,8 +100,8 @@
{
rc = -errno;
error(
- "transferHostDataToSocket: Failed to execute the DMA operation, RC={RC} ADDRESS={ADDR} LENGTH={LEN}",
- "RC", rc, "ADDR", address, "LEN", length);
+ "Failed to execute the DMA operation for transfering remote terminus data to socket at address '{ADDRESS}' and length '{LENGTH}' with response code '{RC}'",
+ "RC", rc, "ADDRESS", address, "LENGTH", length);
return rc;
}
@@ -112,7 +112,7 @@
rc = -errno;
close(fd);
error(
- "transferHostDataToSocket: Closing socket as writeToUnixSocket faile with RC={RC}",
+ "Failed to write to Unix socket, closing socket for transfering remote terminus data to socket with response code '{RC}'",
"RC", rc);
return rc;
}
@@ -140,7 +140,7 @@
else
{
error(
- "transferDataHost: Received interrupt during DMA transfer. Skipping Unmap.");
+ "Received interrupt during DMA transfer for data between BMC and remote terminus. Skipping Unmap.");
}
};
@@ -149,8 +149,9 @@
if (dmaFd < 0)
{
rc = -errno;
- error("transferDataHost : Failed to open the XDMA device, RC={RC}",
- "RC", rc);
+ error(
+ "Failed to open the XDMA device for data transfer between BMC and remote terminus with response code '{RC}'",
+ "RC", rc);
return rc;
}
@@ -162,8 +163,9 @@
if (MAP_FAILED == vgaMem)
{
rc = -errno;
- error("transferDataHost : Failed to mmap the XDMA device, RC={RC}",
- "RC", rc);
+ error(
+ "Failed to mmap the XDMA device for data transfer between BMC and remote terminus with response code '{RC}'",
+ "RC", rc);
return rc;
}
@@ -175,8 +177,8 @@
if (rc == -1)
{
error(
- "transferDataHost upstream : lseek failed, ERROR={ERR}, UPSTREAM={UPSTREAM}, OFFSET={OFFSET}",
- "ERR", errno, "UPSTREAM", upstream, "OFFSET", offset);
+ "Failed to transfer data between BMC and remote terminus due to lseek failure with upstream '{UPSTREAM}' at offset '{OFFSET}', error number - {ERROR_NUM}",
+ "ERROR_NUM", errno, "UPSTREAM", upstream, "OFFSET", offset);
return rc;
}
@@ -189,16 +191,16 @@
if (rc == -1)
{
error(
- "transferDataHost upstream : file read failed, ERROR={ERR}, UPSTREAM={UPSTREAM}, LENGTH={LEN}, OFFSET={OFFSET}",
- "ERR", errno, "UPSTREAM", upstream, "LEN", length, "OFFSET",
- offset);
+ "Failed to transfer data between BMC and remote terminus with file read on upstream '{UPSTREAM}' of length '{LENGTH}' at offset '{OFFSET}' failed, error number - {ERROR_NUM}",
+ "ERROR_NUM", errno, "UPSTREAM", upstream, "LENGTH", length,
+ "OFFSET", offset);
return rc;
}
if (rc != static_cast<int>(length))
{
error(
- "transferDataHost upstream : mismatch between number of characters to read and the length read, LENGTH={LEN} COUNT={RC}",
- "LEN", length, "RC", rc);
+ "Failed to transfer data between BMC and remote terminus mismatched for number of characters to read on upstream '{UPSTREAM}' and the length '{LENGTH}' read and count '{RC}'",
+ "UPSTREAM", upstream, "LENGTH", length, "RC", rc);
return -1;
}
memcpy(static_cast<char*>(vgaMemPtr.get()), buffer.data(),
@@ -215,8 +217,9 @@
{
rc = -errno;
error(
- "transferDataHost : Failed to execute the DMA operation, RC={RC} UPSTREAM={UPSTREAM} ADDRESS={ADDR} LENGTH={LEN}",
- "RC", rc, "UPSTREAM", upstream, "ADDR", address, "LEN", length);
+ "Failed to execute the DMA operation on data between BMC and remote terminus for upstream '{UPSTREAM}' of length '{LENGTH}' at address '{ADDRESS}', response code '{RC}'",
+ "RC", rc, "UPSTREAM", upstream, "ADDRESS", address, "LENGTH",
+ length);
return rc;
}
@@ -226,17 +229,17 @@
if (rc == -1)
{
error(
- "transferDataHost downstream : lseek failed, ERROR={ERR}, UPSTREAM={UPSTREAM}, OFFSET={OFFSET}",
- "ERR", errno, "UPSTREAM", upstream, "OFFSET", offset);
+ "Failed to transfer data between BMC and remote terminus due to lseek failure '{UPSTREAM}' at offset '{OFFSET}' failed, error number - {ERROR_NUM}",
+ "ERROR_NUM", errno, "UPSTREAM", upstream, "OFFSET", offset);
return rc;
}
rc = write(fd, static_cast<const char*>(vgaMemPtr.get()), length);
if (rc == -1)
{
error(
- "transferDataHost downstream : file write failed, ERROR={ERR}, UPSTREAM={UPSTREAM}, LENGTH={LEN}, OFFSET={OFFSET}",
- "ERR", errno, "UPSTREAM", upstream, "LEN", length, "OFFSET",
- offset);
+ "Failed to transfer data between BMC and remote terminus where file write upstream '{UPSTREAM}' of length '{LENGTH}' at offset '{OFFSET}' failed, error number - {ERROR_NUM}",
+ "ERROR_NUM", errno, "UPSTREAM", upstream, "LENGTH", length,
+ "OFFSET", offset);
return rc;
}
}
@@ -280,8 +283,9 @@
}
catch (const std::exception& e)
{
- error("Handle ({HANDLE}) does not exist in the file table: {ERROR}",
- "HANDLE", fileHandle, "ERROR", e);
+ error(
+ "File handle '{HANDLE}' does not exist in the file table, error - {ERROR}",
+ "HANDLE", fileHandle, "ERROR", e);
encode_rw_file_memory_resp(request->hdr.instance_id,
PLDM_READ_FILE_INTO_MEMORY,
PLDM_INVALID_FILE_HANDLE, 0, responsePtr);
@@ -290,8 +294,8 @@
if (!fs::exists(value.fsPath))
{
- error("File does not exist, HANDLE={FILE_HANDLE}", "FILE_HANDLE",
- fileHandle);
+ error("File '{PATH}' and handle '{FILE_HANDLE}' with does not exist",
+ "PATH", value.fsPath, "FILE_HANDLE", fileHandle);
encode_rw_file_memory_resp(request->hdr.instance_id,
PLDM_READ_FILE_INTO_MEMORY,
PLDM_INVALID_FILE_HANDLE, 0, responsePtr);
@@ -302,8 +306,8 @@
if (offset >= fileSize)
{
error(
- "Offset exceeds file size, OFFSET={OFFSTE} FILE_SIZE={FILE_SIZE} FILE_HANDLE{FILE_HANDLE}",
- "OFFSET", offset, "FILE_SIZE", fileSize, "FILE_HANDLE", fileHandle);
+ "Offset '{OFFSET}' exceeds file size '{SIZE}' and file handle '{FILE_HANDLE}'",
+ "OFFSET", offset, "SIZE", fileSize, "FILE_HANDLE", fileHandle);
encode_rw_file_memory_resp(request->hdr.instance_id,
PLDM_READ_FILE_INTO_MEMORY,
PLDM_DATA_OUT_OF_RANGE, 0, responsePtr);
@@ -317,8 +321,8 @@
if (length % dma::minSize)
{
- error("Read length is not a multiple of DMA minSize, LENGTH={LEN}",
- "LEN", length);
+ error("Packet length '{LENGTH}' is non multiple of minimum DMA size",
+ "LENGTH", length);
encode_rw_file_memory_resp(request->hdr.instance_id,
PLDM_READ_FILE_INTO_MEMORY,
PLDM_ERROR_INVALID_LENGTH, 0, responsePtr);
@@ -356,8 +360,8 @@
if (length % dma::minSize)
{
- error("Write length is not a multiple of DMA minSize, LENGTH={LEN}",
- "LEN", length);
+ error("Packet length '{LENGTH}' is non multiple of minimum DMA size",
+ "LENGTH", length);
encode_rw_file_memory_resp(request->hdr.instance_id,
PLDM_WRITE_FILE_FROM_MEMORY,
PLDM_ERROR_INVALID_LENGTH, 0, responsePtr);
@@ -374,8 +378,9 @@
}
catch (const std::exception& e)
{
- error("Handle ({HANDLE}) does not exist in the file table: {ERROR}",
- "HANDLE", fileHandle, "ERROR", e);
+ error(
+ "File handle '{HANDLE}' does not exist in the file table, error - {ERROR}",
+ "HANDLE", fileHandle, "ERROR", e);
encode_rw_file_memory_resp(request->hdr.instance_id,
PLDM_WRITE_FILE_FROM_MEMORY,
PLDM_INVALID_FILE_HANDLE, 0, responsePtr);
@@ -384,8 +389,8 @@
if (!fs::exists(value.fsPath))
{
- error("File does not exist, HANDLE={FILE_HANDLE}", "FILE_HANDLE",
- fileHandle);
+ error("File '{PATH}' does not exist for file handle '{FILE_HANDLE}'",
+ "PATH", value.fsPath, "FILE_HANDLE", fileHandle);
encode_rw_file_memory_resp(request->hdr.instance_id,
PLDM_WRITE_FILE_FROM_MEMORY,
PLDM_INVALID_FILE_HANDLE, 0, responsePtr);
@@ -396,8 +401,9 @@
if (offset >= fileSize)
{
error(
- "Offset exceeds file size, OFFSET={OFFSET} FILE_SIZE={FILE_SIZE} FILE_HANDLE{FILE_HANDLE}",
- "OFFSET", offset, "FILE_SIZE", fileSize, "FILE_HANDLE", fileHandle);
+ "Offset '{OFFSET}' exceeds file size {SIZE} for file '{PATH} and handle {FILE_HANDLE}",
+ "OFFSET", offset, "SIZE", fileSize, "PATH", value.fsPath,
+ "FILE_HANDLE", fileHandle);
encode_rw_file_memory_resp(request->hdr.instance_id,
PLDM_WRITE_FILE_FROM_MEMORY,
PLDM_DATA_OUT_OF_RANGE, 0, responsePtr);
@@ -501,8 +507,9 @@
}
catch (const std::exception& e)
{
- error("Handle ({HANDLE}) does not exist in the file table: {ERROR}",
- "HANDLE", fileHandle, "ERROR", e);
+ error(
+ "File handle '{HANDLE}' does not exist in the file table, error - {ERROR}",
+ "HANDLE", fileHandle, "ERROR", e);
encode_read_file_resp(request->hdr.instance_id,
PLDM_INVALID_FILE_HANDLE, length, responsePtr);
@@ -511,8 +518,8 @@
if (!fs::exists(value.fsPath))
{
- error("File does not exist, HANDLE={FILE_HANDLE}", "FILE_HANDLE",
- fileHandle);
+ error("File '{PATH}' and handle {FILE_HANDLE} does not exist", "PATH",
+ value.fsPath, "FILE_HANDLE", fileHandle);
encode_read_file_resp(request->hdr.instance_id,
PLDM_INVALID_FILE_HANDLE, length, responsePtr);
return response;
@@ -521,8 +528,10 @@
auto fileSize = fs::file_size(value.fsPath);
if (offset >= fileSize)
{
- error("Offset exceeds file size, OFFSET={OFFSET} FILE_SIZE={FILE_SIZE}",
- "OFFSET", offset, "FILE_SIZE", fileSize);
+ error(
+ "Offset '{OFFSET}' exceeds file size '{SIZE}' for file '{PATH}' and file handle '{HANDLE}'",
+ "OFFSET", offset, "SIZE", fileSize, "PATH", value.fsPath, "HANDLE",
+ fileHandle);
encode_read_file_resp(request->hdr.instance_id, PLDM_DATA_OUT_OF_RANGE,
length, responsePtr);
return response;
@@ -584,8 +593,9 @@
}
catch (const std::exception& e)
{
- error("Handle ({HANDLE}) does not exist in the file table: {ERROR}",
- "HANDLE", fileHandle, "ERROR", e);
+ error(
+ "File handle '{HANDLE}' does not exist in the file table, error - {ERROR}",
+ "HANDLE", fileHandle, "ERROR", e);
encode_write_file_resp(request->hdr.instance_id,
PLDM_INVALID_FILE_HANDLE, 0, responsePtr);
return response;
@@ -593,8 +603,8 @@
if (!fs::exists(value.fsPath))
{
- error("File does not exist, HANDLE={FILE_HANDLE}", "FILE_HANDLE",
- fileHandle);
+ error("File '{PATH}' and handle {FILE_HANDLE} does not exist", "PATH",
+ value.fsPath, "FILE_HANDLE", fileHandle);
encode_write_file_resp(request->hdr.instance_id,
PLDM_INVALID_FILE_HANDLE, 0, responsePtr);
return response;
@@ -603,8 +613,10 @@
auto fileSize = fs::file_size(value.fsPath);
if (offset >= fileSize)
{
- error("Offset exceeds file size, OFFSET={OFFSET} FILE_SIZE={FILE_SIZE}",
- "OFFSET", offset, "FILE_SIZE", fileSize);
+ error(
+ "Offset '{OFFSET}' exceeds file size '{SIZE}' for file '{PATH}' and handle {FILE_HANDLE}",
+ "OFFSET", offset, "SIZE", fileSize, "PATH", value.fsPath,
+ "FILE_HANDLE", fileHandle);
encode_write_file_resp(request->hdr.instance_id, PLDM_DATA_OUT_OF_RANGE,
0, responsePtr);
return response;
@@ -656,8 +668,8 @@
}
if (length % dma::minSize)
{
- error("Length is not a multiple of DMA minSize, LENGTH={LEN}", "LEN",
- length);
+ error("Packet length '{LENGTH}' is non multiple of minimum DMA size",
+ "LENGTH", length);
encode_rw_file_by_type_memory_resp(request->hdr.instance_id, cmd,
PLDM_ERROR_INVALID_LENGTH, 0,
responsePtr);
@@ -671,8 +683,8 @@
}
catch (const InternalFailure& e)
{
- error("Unknown file type '{FILE_TYPE}': {ERROR} ", "FILE_TYPE",
- fileType, "ERROR", e);
+ error("Unknown file type '{TYPE}', error - {ERROR} ", "TYPE", fileType,
+ "ERROR", e);
encode_rw_file_by_type_memory_resp(request->hdr.instance_id, cmd,
PLDM_INVALID_FILE_TYPE, 0,
responsePtr);
@@ -737,7 +749,7 @@
}
catch (const InternalFailure& e)
{
- error("Unknown file type '{FILE_TYPE}': {ERROR}", "FILE_TYPE", fileType,
+ error("Unknown file type '{TYPE}', error - {ERROR}", "TYPE", fileType,
"ERROR", e);
encode_rw_file_by_type_resp(request->hdr.instance_id,
PLDM_WRITE_FILE_BY_TYPE,
@@ -787,7 +799,7 @@
}
catch (const InternalFailure& e)
{
- error("Unknown file type '{FILE_TYPE}': {ERROR}", "FILE_TYPE", fileType,
+ error("Unknown file type '{TYPE}', error - {ERROR}", "TYPE", fileType,
"ERROR", e);
encode_rw_file_by_type_resp(request->hdr.instance_id,
PLDM_READ_FILE_BY_TYPE,
@@ -834,7 +846,7 @@
catch (const InternalFailure& e)
{
- error("Unknown file type '{FILE_TYPE}': {ERROR}", "FILE_TYPE", fileType,
+ error("Unknown file type '{TYPE}', error - {ERROR}", "TYPE", fileType,
"ERROR", e);
encode_file_ack_resp(request->hdr.instance_id, PLDM_INVALID_FILE_TYPE,
responsePtr);
@@ -910,7 +922,7 @@
}
catch (const InternalFailure& e)
{
- error("Unknown file type '{FILE_TYPE}': {ERROR}", "FILE_TYPE", fileType,
+ error("Unknown file type '{TYPE}', error - {ERROR}", "TYPE", fileType,
"ERROR", e);
return CmdHandler::ccOnlyResponse(request, PLDM_INVALID_FILE_TYPE);
}
diff --git a/oem/ibm/libpldmresponder/file_io.hpp b/oem/ibm/libpldmresponder/file_io.hpp
index 63cd51b..e455583 100644
--- a/oem/ibm/libpldmresponder/file_io.hpp
+++ b/oem/ibm/libpldmresponder/file_io.hpp
@@ -117,8 +117,7 @@
int file = open(path.string().c_str(), flags);
if (file == -1)
{
- error("File does not exist, path = {FILE_PATH}", "FILE_PATH",
- path.string());
+ error("File at path '{PATH}' does not exist", "PATH", path.string());
encode_rw_file_memory_resp(instanceId, command, PLDM_ERROR, 0,
responsePtr);
return response;
diff --git a/oem/ibm/libpldmresponder/file_io_by_type.cpp b/oem/ibm/libpldmresponder/file_io_by_type.cpp
index 42d963e..1a14555 100644
--- a/oem/ibm/libpldmresponder/file_io_by_type.cpp
+++ b/oem/ibm/libpldmresponder/file_io_by_type.cpp
@@ -81,8 +81,7 @@
fileExists = fs::exists(path);
if (!fileExists)
{
- error("File does not exist. PATH={FILE_PATH}", "FILE_PATH",
- path.c_str());
+ error("File '{PATH}' does not exist.", "PATH", path);
return PLDM_INVALID_FILE_HANDLE;
}
@@ -90,9 +89,8 @@
if (offset >= fileSize)
{
error(
- "Offset exceeds file size, OFFSET={OFFSET} FILE_SIZE={FILE_SIZE}, FILE_HANDLE={FILE_HANDLE}",
- "OFFSET", offset, "FILE_SIZE", fileSize, "FILE_HANDLE",
- fileHandle);
+ "Offset '{OFFSET}' exceeds file size '{SIZE}' for file handle {FILE_HANDLE}",
+ "OFFSET", offset, "SIZE", fileSize, "FILE_HANDLE", fileHandle);
return PLDM_DATA_OUT_OF_RANGE;
}
if (offset + length > fileSize)
@@ -117,8 +115,7 @@
int file = open(path.string().c_str(), flags);
if (file == -1)
{
- error("File does not exist, PATH = {FILE_PATH}", "FILE_PATH",
- path.string());
+ error("File '{PATH}' does not exist.", "PATH", path);
return PLDM_ERROR;
}
utils::CustomFD fd(file);
@@ -192,8 +189,8 @@
{
if (!fs::exists(filePath))
{
- error("File does not exist, HANDLE={FILE_HANDLE} PATH={FILE_PATH}",
- "FILE_HANDLE", fileHandle, "FILE_PATH", filePath.c_str());
+ error("File '{PATH}' and handle {FILE_HANDLE} does not exist", "PATH",
+ filePath, "FILE_HANDLE", fileHandle);
return PLDM_INVALID_FILE_HANDLE;
}
@@ -201,8 +198,8 @@
if (offset >= fileSize)
{
error(
- "Offset exceeds file size, OFFSET={OFFSET} FILE_SIZE={FILE_SIZE} FILE_HANDLE={FILE_HANDLE}",
- "OFFSET", offset, "FILE_SIZE", fileSize, "FILE_HANDLE", fileHandle);
+ "Offset '{OFFSET}' exceeds file size '{SIZE}' and file handle '{FILE_HANDLE}'",
+ "OFFSET", offset, "SIZE", fileSize, "FILE_HANDLE", fileHandle);
return PLDM_DATA_OUT_OF_RANGE;
}
@@ -222,8 +219,9 @@
stream.read(filePos, length);
return PLDM_SUCCESS;
}
- error("Unable to read file, FILE={FILE_PATH}", "FILE_PATH",
- filePath.c_str());
+ error(
+ "Unable to read file '{PATH}' at offset '{OFFSET}' for length '{LENGTH}'",
+ "PATH", filePath, "OFFSET", offset, "LENGTH", length);
return PLDM_ERROR;
}
diff --git a/oem/ibm/libpldmresponder/file_io_type_cert.cpp b/oem/ibm/libpldmresponder/file_io_type_cert.cpp
index c1788e3..b9850f3 100644
--- a/oem/ibm/libpldmresponder/file_io_type_cert.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_cert.cpp
@@ -30,8 +30,8 @@
if (it == certMap.end())
{
error(
- "CertHandler::writeFromMemory:file for type {CERT_TYPE} doesn't exist",
- "CERT_TYPE", certType);
+ "Failed to find file type '{TYPE}' in certificate map. Write from memory during certificate exchange failed",
+ "TYPE", certType);
return PLDM_ERROR;
}
@@ -73,7 +73,7 @@
oem_platform::Handler* /*oemPlatformHandler*/)
{
info(
- "CertHandler::read:Read file response for Sign CSR, file handle: {FILE_HANDLE}",
+ "Read file response for Sign CSR failed and file handle '{FILE_HANDLE}'",
"FILE_HANDLE", fileHandle);
std::string filePath = certFilePath;
filePath += "CSR_" + std::to_string(fileHandle);
@@ -96,8 +96,9 @@
auto it = certMap.find(certType);
if (it == certMap.end())
{
- error("CertHandler::write:file for type {CERT_TYPE} doesn't exist",
- "CERT_TYPE", certType);
+ error(
+ "Failed to find file type '{TYPE}' in certificate map. Write during certificate exchange failed",
+ "TYPE", certType);
return PLDM_ERROR;
}
@@ -105,16 +106,17 @@
int rc = lseek(fd, offset, SEEK_SET);
if (rc == -1)
{
- error("CertHandler::write:lseek failed, ERROR={ERR}, OFFSET={OFFSET}",
- "ERR", errno, "OFFSET", offset);
+ error(
+ "Failed to write certificate lseek at offset '{OFFSET}' of length '{LENGTH}', error number - {ERROR_NUM}",
+ "OFFSET", offset, "LENGTH", length, "ERROR_NUM", errno);
return PLDM_ERROR;
}
rc = ::write(fd, buffer, length);
if (rc == -1)
{
error(
- "CertHandler::write:file write failed, ERROR={ERR}, LENGTH={LEN}, OFFSET={OFFSET}",
- "ERR", errno, "LEN", length, "OFFSET", offset);
+ "Failed to write certificate at offset '{OFFSET}' of length '{LENGTH}', error number - {ERROR_NUM}",
+ "LENGTH", length, "OFFSET", offset, "ERROR_NUM", errno);
return PLDM_ERROR;
}
length = rc;
@@ -155,8 +157,8 @@
catch (const std::exception& e)
{
error(
- "CertHandler::write:failed to set Client certificate, ERROR={ERR_EXCEP}",
- "ERR_EXCEP", e.what());
+ "Failed to write for set client certificate, error - {ERROR}",
+ "ERROR", e);
return PLDM_ERROR;
}
PropertyValue valueStatus{
@@ -167,7 +169,7 @@
try
{
info(
- "CertHandler::write:Client cert write, status: complete. File handle: {FILE_HANDLE}",
+ "Client certificate write status 'complete' for file handle '{FILE_HANDLE}'",
"FILE_HANDLE", fileHandle);
pldm::utils::DBusHandler().setDbusProperty(dbusMappingStatus,
valueStatus);
@@ -175,8 +177,8 @@
catch (const std::exception& e)
{
error(
- "CertHandler::write:failed to set status property of certicate entry, ERROR={ERR_EXCEP}",
- "ERR_EXCEP", e.what());
+ "Failed to write the set status property for certificate entry, error - {ERROR}",
+ "ERROR", e);
return PLDM_ERROR;
}
fs::remove(filePath);
@@ -189,15 +191,15 @@
try
{
info(
- "CertHandler::write:Client cert write, status: Bad CSR. File handle: {FILE_HANDLE}",
+ "Client certificate write status 'Bad CSR' for file handle '{FILE_HANDLE}'",
"FILE_HANDLE", fileHandle);
pldm::utils::DBusHandler().setDbusProperty(dbusMapping, value);
}
catch (const std::exception& e)
{
error(
- "CertHandler::write:failed to set status property of certicate entry, {ERR_EXCEP}",
- "ERR_EXCEP", e.what());
+ "Failed to write the set status property for certficate entry, error - {ERROR}",
+ "ERROR", e);
return PLDM_ERROR;
}
}
@@ -221,7 +223,7 @@
if (certType == PLDM_FILE_TYPE_SIGNED_CERT)
{
info(
- "CertHandler::newFileAvailable:new file available client cert file, file handle: {FILE_HANDLE}",
+ "New file available for client certificate file with file handle {FILE_HANDLE}",
"FILE_HANDLE", fileHandle);
fileFd = open(
(filePath + "ClientCert_" + std::to_string(fileHandle)).c_str(),
@@ -235,8 +237,8 @@
if (fileFd == -1)
{
error(
- "CertHandler::newFileAvailable:failed to open file for type {CERT_TYPE} ERROR={ERR}",
- "CERT_TYPE", certType, "ERR", errno);
+ "Failed to open new file available with file type '{TYPE}', error number - {ERROR_NUM}",
+ "TYPE", certType, "ERROR_NUM", errno);
return PLDM_ERROR;
}
certMap.emplace(certType, std::tuple(fileFd, length));
@@ -264,8 +266,8 @@
{
if (metaDataValue1 == PLDM_SUCCESS)
{
- error(
- "CertHandler::newFileAvailableWithMetaData:new file available client cert file, file handle: {FILE_HANDLE}",
+ info(
+ "Client certificate new file available with meta data for file handle '{FILE_HANDLE}'",
"FILE_HANDLE", fileHandle);
fileFd = open(
(filePath + "ClientCert_" + std::to_string(fileHandle)).c_str(),
@@ -274,8 +276,8 @@
else if (metaDataValue1 == PLDM_INVALID_CERT_DATA)
{
error(
- "newFileAvailableWithMetaData:client cert file Invalid data, file handle: {FILE_HANDLE}",
- "FILE_HANDLE", fileHandle);
+ "New file available with meta data for client certificate file has invalid data '{META_DATA}' with file handle '{FILE_HANDLE}'",
+ "META_DATA", metaDataValue1, "FILE_HANDLE", fileHandle);
DBusMapping dbusMapping{certObjPath + std::to_string(fileHandle),
certEntryIntf, "Status", "string"};
std::string status = "xyz.openbmc_project.Certs.Entry.State.BadCSR";
@@ -287,8 +289,8 @@
catch (const std::exception& e)
{
error(
- "newFileAvailableWithMetaData:Failed to set status property of certicate entry, ERROR= {ERR_EXCEP}",
- "ERR_EXCEP", e.what());
+ "Failed to set set status property of certificate entry in new file available with meta data, error - {ERROR}",
+ "ERROR", e);
return PLDM_ERROR;
}
}
@@ -301,8 +303,8 @@
if (fileFd == -1)
{
error(
- "newFileAvailableWithMetaData:failed to open file for type {CERT_TYPE} ERROR={ERR}",
- "CERT_TYPE", certType, "ERR", errno);
+ "Failed to open file type '{TYPE}' but New file available with meta data, error number - {ERROR_NUM}",
+ "TYPE", certType, "ERROR_NUM", errno);
return PLDM_ERROR;
}
certMap.emplace(certType, std::tuple(fileFd, length));
@@ -335,8 +337,8 @@
catch (const std::exception& e)
{
error(
- "CertHandler::fileAckWithMetaData:Failed to set status property of certicate entry, ERROR={ERR_EXCEP}",
- "ERR_EXCEP", e.what());
+ "Failed to set status property of certificate entry for file ack with meta data, error - {ERROR}",
+ "ERROR", e);
return PLDM_ERROR;
}
}
diff --git a/oem/ibm/libpldmresponder/file_io_type_dump.cpp b/oem/ibm/libpldmresponder/file_io_type_dump.cpp
index b5bc53c..7ade97b 100644
--- a/oem/ibm/libpldmresponder/file_io_type_dump.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_dump.cpp
@@ -67,9 +67,8 @@
catch (const sdbusplus::exception_t& e)
{
error(
- "findDumpObjPath: Error {ERR_EXCEP} found with GetManagedObjects call in findDumpObjPath with objPath={OBJ_PATH} and intf={DUMP_INFT}",
- "ERR_EXCEP", e.what(), "OBJ_PATH", DUMP_MANAGER_PATH, "DUMP_INFT",
- dumpEntryIntf);
+ "Failed to retrieve dump object using GetManagedObjects call for path '{PATH}' and interface '{INTERFACE}', error - {ERROR}",
+ "PATH", DUMP_MANAGER_PATH, "INTERFACE", dumpEntryIntf, "ERROR", e);
return curResDumpEntryPath;
}
@@ -99,8 +98,8 @@
else
{
error(
- "Invalid SourceDumpId in curResDumpEntryPath {CUR_RES_DUMP_PATH} but continuing with next entry for a match...",
- "CUR_RES_DUMP_PATH", curResDumpEntryPath);
+ "Invalid SourceDumpId in curResDumpEntryPath '{PATH}' but continuing with next entry for a match...",
+ "PATH", object.first.str);
}
}
}
@@ -134,9 +133,8 @@
catch (const std::exception& e)
{
error(
- "newFileAvailable: Error {ERR_EXCEP} found while notifying new dump to dump manager with objPath={OBJ_PATH} and intf={DUMP_INTF}",
- "ERR_EXCEP", e.what(), "OBJ_PATH", notifyObjPath, "DUMP_INTF",
- dumpInterface);
+ "Error '{ERROR}' found for new file available while notifying new dump to dump manager with object path {PATH} and interface {INTERFACE}",
+ "ERROR", e, "PATH", notifyObjPath, "INTERFACE", dumpInterface);
return PLDM_ERROR;
}
@@ -162,9 +160,8 @@
catch (const std::exception& e)
{
error(
- "getOffloadUri: Error {ERR_EXCEP} found while fetching the dump offload URI with objPath={OBJ_PATH} and intf={SOCKET_INTF}",
- "ERR_EXCEP", e.what(), "OBJ_PATH", path.c_str(), "SOCKET_INTF",
- socketInterface);
+ "Error '{ERROR}' found while fetching the dump offload URI with object path '{PATH}' and interface '{INTERFACE}'",
+ "ERROR", e, "PATH", path, "INTERFACE", socketInterface);
}
return socketInterface;
@@ -182,8 +179,8 @@
sock = -errno;
close(DumpHandler::fd);
error(
- "DumpHandler::writeFromMemory: setupUnixSocket() failed ERR={ERR_NO}",
- "ERR_NO", sock);
+ "Failed to setup Unix socket while write from memory for interface '{INTERFACE}', response code '{SOCKET_RC}'",
+ "INTERFACE", socketInterface, "SOCKET_RC", sock);
std::remove(socketInterface.c_str());
return PLDM_ERROR;
}
@@ -203,8 +200,9 @@
close(DumpHandler::fd);
auto socketInterface = getOffloadUri(fileHandle);
std::remove(socketInterface.c_str());
- error("DumpHandler::write: writeToUnixSocket() failed ERR={RC_VAL}",
- "RC_VAL", rc);
+ error(
+ "Failed to do dump write to Unix socket for interface '{INTERFACE}', response code '{RC}'",
+ "INTERFACE", socketInterface, "RC", rc);
return PLDM_ERROR;
}
@@ -218,7 +216,7 @@
{
if (fileStatus != PLDM_SUCCESS)
{
- error("Failue in resource dump file ack");
+ error("Failure in resource dump file ack");
pldm::utils::reportError(
"xyz.openbmc_project.bmc.pldm.InternalFailure");
@@ -233,8 +231,8 @@
catch (const std::exception& e)
{
error(
- "fileAck: Error {ERR_EXCEP} found while setting the dump progress status as Failed with objPath={OBJ_PATH} and intf=Common.Progress",
- "ERR_EXCEP", e.what(), "OBJ_PATH", path.c_str());
+ "Error '{ERROR}' found for file ack while setting the dump progress status as 'Failed' with object path '{PATH}' and interface 'xyz.openbmc_project.Common.Progress'",
+ "ERROR", e, "PATH", path);
}
}
@@ -267,8 +265,8 @@
catch (const std::exception& e)
{
error(
- "fileAck: Failed to make a d-bus call to DUMP manager to reset source dump id of {FILE_PATH}, with ERROR={ERR_EXCEP}",
- "FILE_PATH", path.c_str(), "ERR_EXCEP", e.what());
+ "Failed to make a D-bus call to DUMP manager for reseting source dump file '{PATH}' on interface '{INTERFACE}', error - {ERROR}",
+ "PATH", path, "INTERFACE", dumpIntf, "ERROR", e);
pldm::utils::reportError(
"xyz.openbmc_project.bmc.PLDM.fileAck.SourceDumpIdResetFail");
return PLDM_ERROR;
@@ -285,8 +283,8 @@
catch (const std::exception& e)
{
error(
- "fileAck: Failed to make a d-bus method to delete the dump entry {FILE_PATH}, with ERROR={ERR_EXCEP}",
- "FILE_PATH", path.c_str(), "ERR_EXCEP", e.what());
+ "Failed to make a D-bus call to DUMP manager for delete dump file '{PATH}', error - {ERROR}",
+ "PATH", path, "ERROR", e);
pldm::utils::reportError(
"xyz.openbmc_project.bmc.PLDM.fileAck.DumpEntryDeleteFail");
return PLDM_ERROR;
@@ -306,8 +304,8 @@
catch (const std::exception& e)
{
error(
- "fileAck: Failed to make a d-bus method to set the dump offloaded property to true with path={FILE_PATH} and with ERROR={ERR_EXCEP}",
- "FILE_PATH", path.c_str(), "ERR_EXCEP", e.what());
+ "Failed to make a D-bus call to DUMP manager to set the dump offloaded property 'true' for dump file '{PATH}', error - {ERROR}",
+ "PATH", path, "ERROR", e);
}
auto socketInterface = getOffloadUri(fileHandle);
diff --git a/oem/ibm/libpldmresponder/file_io_type_lid.hpp b/oem/ibm/libpldmresponder/file_io_type_lid.hpp
index 11be0e6..da95907 100644
--- a/oem/ibm/libpldmresponder/file_io_type_lid.hpp
+++ b/oem/ibm/libpldmresponder/file_io_type_lid.hpp
@@ -129,8 +129,8 @@
auto fd = open(lidPath.c_str(), flags, S_IRUSR);
if (fd == -1)
{
- error("Could not open file for writing {LID_PATH}", "LID_PATH",
- lidPath.c_str());
+ error("Failed to open file '{LID_PATH}' for writing", "LID_PATH",
+ lidPath);
return PLDM_ERROR;
}
close(fd);
@@ -138,7 +138,8 @@
rc = transferFileData(lidPath, false, offset, length, address);
if (rc != PLDM_SUCCESS)
{
- error("writeFileFromMemory failed with rc= {RC}", "RC", rc);
+ error("Failed to write file from memory with response code '{RC}'",
+ "RC", rc);
return rc;
}
if (lidType == PLDM_FILE_TYPE_LID_MARKER)
@@ -207,8 +208,8 @@
if (offset > fileSize)
{
error(
- "Offset exceeds file size, OFFSET={OFFSET} FILE_SIZE={FILE_SIZE} FILE_HANDLE{FILE_HANDLE}",
- "OFFSET", offset, "FILE_SIZE", fileSize, "FILE_HANDLE",
+ "Offset '{OFFSET}' exceeds file size '{SIZE}' and file handle '{FILE_HANDLE}'",
+ "OFFSET", offset, "SIZE", fileSize, "FILE_HANDLE",
fileHandle);
return PLDM_DATA_OUT_OF_RANGE;
}
@@ -218,30 +219,31 @@
flags = O_WRONLY | O_CREAT | O_TRUNC | O_SYNC;
if (offset > 0)
{
- error("Offset is non zero in a new file");
+ error("Offset '{OFFSET}' is non zero in a new file '{PATH}'",
+ "OFFSET", offset, "PATH", lidPath);
return PLDM_DATA_OUT_OF_RANGE;
}
}
auto fd = open(lidPath.c_str(), flags, S_IRUSR);
if (fd == -1)
{
- error("could not open file {LID_PATH}", "LID_PATH",
- lidPath.c_str());
+ error("Failed to open file '{LID_PATH}'", "LID_PATH", lidPath);
return PLDM_ERROR;
}
rc = lseek(fd, offset, SEEK_SET);
if (rc == -1)
{
- error("lseek failed, ERROR={ERR}, OFFSET={OFFSET}", "ERR", errno,
- "OFFSET", offset);
+ error(
+ "Failed to lseek at offset '{OFFSET}', error number - {ERROR_NUM}",
+ "ERROR_NUM", errno, "OFFSET", offset);
return PLDM_ERROR;
}
rc = ::write(fd, buffer, length);
if (rc == -1)
{
error(
- "file write failed, ERROR={ERR}, LENGTH={LEN}, OFFSET={OFFSET}",
- "ERR", errno, "LEN", length, "OFFSET", offset);
+ "Failed to do file write of length '{LENGTH}' at offset '{OFFSET}', error number - {ERROR_NUM}",
+ "LENGTH", length, "OFFSET", offset, "ERROR_NUM", errno);
return PLDM_ERROR;
}
else if (rc == static_cast<int>(length))
diff --git a/oem/ibm/libpldmresponder/file_io_type_pel.cpp b/oem/ibm/libpldmresponder/file_io_type_pel.cpp
index 8fe6d76..d33479f 100644
--- a/oem/ibm/libpldmresponder/file_io_type_pel.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_pel.cpp
@@ -82,8 +82,7 @@
}
else
{
- error("Unable to open PEL file {PEL_FILE_NAME}", "PEL_FILE_NAME",
- pelFileName);
+ error("Unable to open PEL file '{FILE}'", "FILE", pelFileName);
}
}
@@ -116,8 +115,8 @@
catch (const std::exception& e)
{
error(
- "GetPEL D-Bus call failed, PEL id = 0x{FILE_HANDLE}, error ={ERR_EXCEP}",
- "FILE_HANDLE", lg2::hex, fileHandle, "ERR_EXCEP", e.what());
+ "Failed to get PEL D-Bus call for PEL ID '{FILE_HANDLE}', error - {ERROR}",
+ "FILE_HANDLE", lg2::hex, fileHandle, "ERROR", e);
return PLDM_ERROR;
}
@@ -145,15 +144,14 @@
off_t fileSize = lseek(fd, 0, SEEK_END);
if (fileSize == -1)
{
- error("file seek failed");
+ error("File lseek failed");
return PLDM_ERROR;
}
if (offset >= fileSize)
{
error(
- "Offset exceeds file size, OFFSET={OFFSET} FILE_SIZE={FILE_SIZE} FILE_HANDLE{FILE_HANDLE}",
- "OFFSET", offset, "FILE_SIZE", fileSize, "FILE_HANDLE",
- fileHandle);
+ "Offset '{OFFSET}' exceeds file size {SIZE}, file handle {FILE_HANDLE}",
+ "OFFSET", offset, "SIZE", fileSize, "FILE_HANDLE", fileHandle);
return PLDM_DATA_OUT_OF_RANGE;
}
if (offset + length > fileSize)
@@ -163,7 +161,8 @@
auto rc = lseek(fd, offset, SEEK_SET);
if (rc == -1)
{
- error("file seek failed");
+ error("Failed to do file lseek at offset '{OFFSET}'", "OFFSET",
+ offset);
return PLDM_ERROR;
}
size_t currSize = response.size();
@@ -173,22 +172,24 @@
rc = ::read(fd, filePos, length);
if (rc == -1)
{
- error("file read failed");
+ error(
+ "Failed to do file read of length '{LENGTH}' at offset '{OFFSET}'",
+ "LENGTH", length, "OFFSET", filePos);
return PLDM_ERROR;
}
if (rc != length)
{
error(
- "mismatch between number of characters to read and the length read, LENGTH={LEN} COUNT={CNT}",
- "LEN", length, "CNT", rc);
+ "Mismatch between number of characters to read and the read length '{LENGTH}' and count '{RC}'",
+ "LENGTH", length, "RC", rc);
return PLDM_ERROR;
}
}
catch (const std::exception& e)
{
error(
- "GetPEL D-Bus call failed on PEL ID 0x{FILE_HANDLE}, error ={ERR_EXCEP}",
- "FILE_HANDLE", lg2::hex, fileHandle, "ERR_EXCEP", e.what());
+ "Failed to get PEL D-Bus call on PEL ID {FILE_HANDLE}, error - {ERROR}",
+ "FILE_HANDLE", lg2::hex, fileHandle, "ERROR", e);
return PLDM_ERROR;
}
return PLDM_SUCCESS;
@@ -202,7 +203,8 @@
int fd = mkstemp(tmpFile);
if (fd == -1)
{
- error("failed to create a temporary pel, ERROR={ERR}", "ERR", errno);
+ error("Failed to create a temporary pel, error number - {ERROR_NUM}",
+ "ERROR_NUM", errno);
return PLDM_ERROR;
}
close(fd);
@@ -232,9 +234,10 @@
}
catch (const sdbusplus::exception_t& e)
{
- error("Mapper call failed when trying to find logging service "
- "to ack PEL ID {FILE_HANDLE} error = {ERR_EXCEP}",
- "FILE_HANDLE", lg2::hex, fileHandle, "ERR_EXCEP", e);
+ error(
+ "Failed to do mapper call when trying to find logging service "
+ "to ack PEL ID '{FILE_HANDLE}', error - {ERROR}",
+ "FILE_HANDLE", lg2::hex, fileHandle, "ERROR", e);
return PLDM_ERROR;
}
}
@@ -251,8 +254,8 @@
catch (const std::exception& e)
{
error(
- "HostAck D-Bus call failed on PEL ID {FILE_HANDLE}, error = {ERR_EXCEP}",
- "FILE_HANDLE", lg2::hex, fileHandle, "ERR_EXCEP", e);
+ "Failure in HostReject ack D-Bus call on PEL ID '{FILE_HANDLE}', error - {ERROR}",
+ "FILE_HANDLE", lg2::hex, fileHandle, "ERROR", e);
return PLDM_ERROR;
}
}
@@ -270,7 +273,7 @@
else
{
error(
- "Invalid file status {STATUS} in PEL file ack response for PEL {FILE_HANDLE}",
+ "Invalid file status '{STATUS}' in PEL file ack response for PEL '{FILE_HANDLE}'",
"STATUS", lg2::hex, fileStatus, "FILE_HANDLE", lg2::hex,
fileHandle);
return PLDM_ERROR;
@@ -285,9 +288,9 @@
}
catch (const std::exception& e)
{
- error("HostReject D-Bus call failed on PEL ID {FILE_HANDLE}, "
- "error = {ERR_EXCEP}, status = {STATUS}",
- "FILE_HANDLE", lg2::hex, fileHandle, "ERR_EXCEP", e, "STATUS",
+ error("Failure in HostReject D-Bus call on PEL ID '{FILE_HANDLE}', "
+ "error - {ERROR}, status - {STATUS}",
+ "FILE_HANDLE", lg2::hex, fileHandle, "ERROR", e, "STATUS",
lg2::hex, fileStatus);
return PLDM_ERROR;
}
@@ -323,8 +326,8 @@
catch (const std::exception& e)
{
error(
- "failed to make a d-bus call to PEL daemon, PEL_FILE_NAME={PEL_FILE_NAME), ERROR={ERR_EXCEP}",
- "PEL_FILE_NAME", pelFileName, "ERR_EXCEP", e.what());
+ "Failed to make a d-bus call to PEL daemon, PEL file name '{FILE}', ERROR - {ERROR}",
+ "FILE", pelFileName, "ERROR", e);
return PLDM_ERROR;
}
@@ -338,7 +341,7 @@
if (offset > 0)
{
- error("Offset is non zero");
+ error("Offset '{OFFSET}' is non zero", "OFFSET", offset);
return PLDM_ERROR;
}
@@ -346,7 +349,8 @@
auto fd = mkstemp(tmpFile);
if (fd == -1)
{
- error("failed to create a temporary pel, ERROR={ERR}", "ERR", errno);
+ error("Failed to create a temporary PEL, error number - {ERROR_NUM}",
+ "ERROR_NUM", errno);
return PLDM_ERROR;
}
@@ -364,8 +368,9 @@
if (rc == -1)
{
- error("file write failed, ERROR={ERR}, LENGTH={LEN}, OFFSET={OFFSET}",
- "ERR", errno, "LEN", length, "OFFSET", offset);
+ error(
+ "Failed to do file write of length '{LENGTH}' at offset '{OFFSET}', error number - {ERROR_NUM}",
+ "LENGTH", length, "OFFSET", offset, "ERROR_NUM", errno);
fs::remove(tmpFile);
return PLDM_ERROR;
}
@@ -376,8 +381,9 @@
rc = storePel(path.string());
if (rc != PLDM_SUCCESS)
{
- error("save PEL failed, ERROR = {RC} tmpFile = {TMP_FILE}", "RC",
- rc, "TMP_FILE", tmpFile);
+ error(
+ "Failed to save PEL in temp file '{FILE}', response code '{RC}'",
+ "RC", rc, "FILE", tmpFile);
}
}
diff --git a/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp b/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp
index ce860d9..9c567e5 100644
--- a/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp
@@ -40,8 +40,8 @@
catch (const std::exception& e)
{
error(
- "failed to make a d-bus call to host-postd daemon, ERROR={ERR_EXCEP}",
- "ERR_EXCEP", e.what());
+ "Failed to make a d-bus call to host-postd daemon, error - {ERROR}",
+ "ERROR", e);
return PLDM_ERROR;
}
diff --git a/oem/ibm/libpldmresponder/file_io_type_vpd.cpp b/oem/ibm/libpldmresponder/file_io_type_vpd.cpp
index ade6ee6..4ae11ac 100644
--- a/oem/ibm/libpldmresponder/file_io_type_vpd.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_vpd.cpp
@@ -41,16 +41,15 @@
catch (const std::exception& e)
{
error(
- "Get keyword error from dbus interface :{KEYWORD_INTF} ERROR={ERR_EXCEP}",
- "KEYWORD_INTF", keywrdInterface, "ERR_EXCEP", e.what());
+ "Get keyword error from dbus interface {INTERFACE}, error - {ERROR}",
+ "INTERFACE", keywrdInterface, "ERROR", e);
}
uint32_t keywrdSize = std::get<std::vector<byte>>(keywrd).size();
if (length < keywrdSize)
{
- error(
- "length requested is less the keyword size, length:{LEN} keyword size:{KEYWORD_SIZE}",
- "LEN", length, "KEYWORD_SIZE", keywrdSize);
+ error("Length '{LENGTH}' requested is less than keyword size '{SIZE}'",
+ "LENGTH", length, "SIZE", keywrdSize);
return PLDM_ERROR_INVALID_DATA;
}
@@ -69,8 +68,9 @@
auto fd = open(keywrdFilePath, std::ios::out | std::ofstream::binary);
if (!keywrdFile)
{
- error("VPD keyword file open error: {KEYWORD_FILE_PATH} errno: {ERR}",
- "KEYWORD_FILE_PATH", keywrdFilePath, "ERR", errno);
+ error(
+ "Failed to open VPD keyword file '{PATH}', error number - {ERROR_NUM}",
+ "PATH", keywrdFilePath, "ERROR_NUM", errno);
pldm::utils::reportError(
"xyz.openbmc_project.PLDM.Error.readKeywordHandler.keywordFileOpenError");
return PLDM_ERROR;
@@ -78,8 +78,8 @@
if (offset > keywrdSize)
{
- error("Offset exceeds file size, OFFSET={OFFSET} FILE_SIZE={FILE_SIZE}",
- "OFFSET", offset, "FILE_SIZE", keywrdSize);
+ error("Offset '{OFFSET}' exceeds file size '{SIZE}'", "OFFSET", offset,
+ "SIZE", keywrdSize);
return PLDM_DATA_OUT_OF_RANGE;
}
@@ -90,7 +90,9 @@
auto returnCode = lseek(fd, offset, SEEK_SET);
if (returnCode == -1)
{
- error("Could not find keyword data at given offset. File Seek failed");
+ error(
+ "Could not find keyword data of length '{LENGTH}' at given offset '{OFFSET}'. File Seek failed with response code '{RC}'",
+ "LENGTH", length, "OFFSET", offset, "RC", returnCode);
return PLDM_ERROR;
}
@@ -98,8 +100,7 @@
keywrdSize);
if (keywrdFile.bad())
{
- error("Error while writing to file: {KEYWORD_FILE_PATH}",
- "KEYWORD_FILE_PATH", keywrdFilePath);
+ error("Error while writing to file '{PATH}'", "PATH", keywrdFilePath);
}
keywrdFile.close();
@@ -107,8 +108,8 @@
fs::remove(keywrdFilePath);
if (rc)
{
- error("Read error for keyword file with size: {KEYWORD_SIZE}",
- "KEYWORD_SIZE", keywrdSize);
+ error("Read error for keyword file with size '{SIZE}'", "SIZE",
+ keywrdSize);
pldm::utils::reportError(
"xyz.openbmc_project.PLDM.Error.readKeywordHandler.keywordFileReadError");
return PLDM_ERROR;
diff --git a/oem/ibm/libpldmresponder/file_table.cpp b/oem/ibm/libpldmresponder/file_table.cpp
index b030f82..d0b06bc 100644
--- a/oem/ibm/libpldmresponder/file_table.cpp
+++ b/oem/ibm/libpldmresponder/file_table.cpp
@@ -17,15 +17,16 @@
std::ifstream jsonFile(fileTableConfigPath);
if (!jsonFile.is_open())
{
- error("File table config file does not exist, FILE={TABLE_CONFIG_PATH}",
- "TABLE_CONFIG_PATH", fileTableConfigPath.c_str());
+ error("File table config file '{PATH}' does not exist", "PATH",
+ fileTableConfigPath);
return;
}
auto data = Json::parse(jsonFile, nullptr, false);
if (data.is_discarded())
{
- error("Parsing config file failed");
+ error("Failed to parse config file '{PATH}'", "PATH",
+ fileTableConfigPath);
return;
}
diff --git a/oem/ibm/libpldmresponder/fru_oem_ibm.cpp b/oem/ibm/libpldmresponder/fru_oem_ibm.cpp
index c9360df..89b9f41 100644
--- a/oem/ibm/libpldmresponder/fru_oem_ibm.cpp
+++ b/oem/ibm/libpldmresponder/fru_oem_ibm.cpp
@@ -158,8 +158,10 @@
}
catch (const std::exception& e)
{
- error("Failed to set '{PROPERTY}' property: {ERROR}", "PROPERTY",
- propertyName, "ERROR", e);
+ error(
+ "Failed to set property '{PROPERTY} at path '{PATH}' and interface '{INTERFACE}', error - {ERROR}",
+ "PROPERTY", propertyName, "PATH", adapterObjPath, "INTERFACE",
+ dbusMapping.interface, "ERROR", e);
}
}
@@ -184,7 +186,8 @@
}
catch (const std::exception& e)
{
- error("Failed to make a DBus call to VPD manager: {ERROR}", "ERROR", e);
+ error("Failed to make a DBus call to VPD manager, error - {ERROR}",
+ "ERROR", e);
}
}
diff --git a/oem/ibm/libpldmresponder/inband_code_update.cpp b/oem/ibm/libpldmresponder/inband_code_update.cpp
index e4ab130..71b6ec3 100644
--- a/oem/ibm/libpldmresponder/inband_code_update.cpp
+++ b/oem/ibm/libpldmresponder/inband_code_update.cpp
@@ -93,9 +93,8 @@
}
catch (const std::exception& e)
{
- error(
- "failed to set the next boot side to {OBJ_PATH} ERROR={ERR_EXCEP}",
- "OBJ_PATH", objPath.c_str(), "ERR_EXCEP", e.what());
+ error("Failed to set the next boot side to {PATH} , error - {ERROR}",
+ "PATH", objPath, "ERROR", e);
return PLDM_ERROR;
}
return PLDM_SUCCESS;
@@ -118,10 +117,9 @@
catch (const std::exception& e)
{
error(
- "Failed To set RequestedApplyTime property, OBJ_PATH={OBJ_PATH}, INTERFACE={INTERFACE}, PROP_NAME={PROP_NAME}, ERROR={ERR_EXCEP}",
- "OBJ_PATH", dbusMapping.objectPath, "INTERFACE",
- dbusMapping.interface, "PROP_NAME", dbusMapping.propertyName,
- "ERR_EXCEP", e.what());
+ "Failed to set property '{PROPERTY}' at path '{PATH}' and interface '{INTERFACE}', error - {ERROR}",
+ "PATH", dbusMapping.objectPath, "INTERFACE", dbusMapping.interface,
+ "PROPERTY", dbusMapping.propertyName, "ERROR", e);
rc = PLDM_ERROR;
}
return rc;
@@ -144,10 +142,9 @@
catch (const std::exception& e)
{
error(
- "Failed To set RequestedActivation property, OBJ_PATH={OBJ_PATH}, INTERFACE={INTERFACE}, PROP_NAME={PROP_NAME}, ERROR={ERR_EXCEP}",
- "OBJ_PATH", dbusMapping.objectPath, "INTERFACE",
- dbusMapping.interface, "PROP_NAME", dbusMapping.propertyName,
- "ERR_EXCEP", e.what());
+ "Failed to set property {PROPERTY} at path '{PATH}' and interface '{INTERFACE}', error - {ERROR}",
+ "PATH", dbusMapping.objectPath, "INTERFACE", dbusMapping.interface,
+ "PROPERTY", dbusMapping.propertyName, "ERROR", e);
rc = PLDM_ERROR;
}
return rc;
@@ -193,8 +190,8 @@
catch (const std::exception& e)
{
error(
- "failed to make a d-bus call to Object Mapper Association, ERROR={ERR_EXCEP}",
- "ERR_EXCEP", e.what());
+ "Failed to make a d-bus call to Object Mapper Association, error - {ERROR}",
+ "ERROR", e);
return;
}
@@ -293,6 +290,7 @@
auto rc = setRequestedActivation();
if (rc != PLDM_SUCCESS)
{
+ error("Could not set Requested Activation");
CodeUpdateState state = CodeUpdateState::FAIL;
setCodeUpdateProgress(false);
auto sensorId = getFirmwareUpdateSensor();
@@ -300,7 +298,6 @@
sensorId, PLDM_STATE_SENSOR_STATE, 0,
uint8_t(state),
uint8_t(CodeUpdateState::START));
- error("could not set RequestedActivation");
}
break;
}
@@ -308,9 +305,9 @@
catch (const sdbusplus::exception_t& e)
{
error(
- "Error in getting Activation status,ERROR= {ERR_EXCEP}, INTERFACE={IMG_INTERFACE}, OBJECT PATH={OBJ_PATH}",
- "ERR_EXCEP", e.what(), "IMG_INTERFACE", imageInterface,
- "OBJ_PATH", imageObjPath);
+ "Failed to get activation status for interface '{INTERFACE}' and object path '{PATH}', error - {ERROR}",
+ "ERROR", e, "INTERFACE", imageInterface, "PATH",
+ imageObjPath);
}
}
}
@@ -341,8 +338,7 @@
{
if (!fs::is_directory(dirPath))
{
- error("The directory does not exist, dirPath = {DIR_PATH}", "DIR_PATH",
- dirPath.c_str());
+ error("The directory '{PATH}' does not exist", "PATH", dirPath);
return;
}
for (const auto& iter : fs::directory_iterator(dirPath))
@@ -380,9 +376,8 @@
catch (const std::exception& e)
{
error(
- "Failed to delete image, OBJ_PATH={OBJ_PATH}, INTERFACE={INTERFACE}, ERROR={ERR_EXCEP}",
- "OBJ_PATH", SW_OBJ_PATH, "INTERFACE", DELETE_INTF, "ERR_EXCEP",
- e.what());
+ "Failed to delete image at path '{PATH}' and interface '{INTERFACE}', error - {ERROR}",
+ "PATH", SW_OBJ_PATH, "INTERFACE", DELETE_INTF, "ERROR", e);
return;
}
}
@@ -477,7 +472,7 @@
std::ifstream ifs(filePath, std::ios::in | std::ios::binary);
if (!ifs)
{
- error("ifstream open error: {DIR_PATH}", "DIR_PATH", filePath.c_str());
+ error("Failed to opening file '{FILE}' ifstream", "PATH", filePath);
return PLDM_ERROR;
}
ifs.seekg(0);
@@ -496,7 +491,7 @@
constexpr auto magicNumber = 0x0222;
if (htons(header.magicNumber) != magicNumber)
{
- error("Invalid magic number: {DIR_PATH}", "DIR_PATH", filePath.c_str());
+ error("Invalid magic number for file '{PATH}'", "PATH", filePath);
ifs.close();
return PLDM_ERROR;
}
@@ -609,7 +604,8 @@
}
else if (nextPid < 0)
{
- error("Error occurred during fork. ERROR={ERR}", "ERR", errno);
+ error("Failure occurred during fork, error number - {ERROR_NUM}",
+ "ERROR_NUM", errno);
exit(EXIT_FAILURE);
}
@@ -622,21 +618,23 @@
int status;
if (waitpid(pid, &status, 0) < 0)
{
- error("Error occurred during waitpid. ERROR={ERR}", "ERR", errno);
+ error("Error occurred during waitpid, error number - {ERROR_NUM}",
+ "ERROR_NUM", errno);
return PLDM_ERROR;
}
else if (WEXITSTATUS(status) != 0)
{
error(
- "Failed to execute the assembling of the image. STATUS={IMG_STATUS}",
+ "Failed to execute the assembling of the image, status is {IMG_STATUS}",
"IMG_STATUS", status);
return PLDM_ERROR;
}
}
else
{
- error("Error occurred during fork. ERROR={ERR}", "ERR", errno);
+ error("Error occurred during fork, error number - {ERROR_NUM}}",
+ "ERROR_NUM", errno);
return PLDM_ERROR;
}
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
index 8e207be..906e964 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
@@ -167,7 +167,7 @@
reinterpret_cast<pldm_state_effecter_pdr*>(entry.data());
if (!pdr)
{
- error("Failed to get record by PDR type, ERROR:{ERR_CODE}", "ERR_CODE",
+ error("Failed to get record by PDR type, error - {ERROR}", "ERROR",
lg2::hex,
static_cast<unsigned>(PLDM_PLATFORM_INVALID_EFFECTER_ID));
return;
@@ -219,7 +219,7 @@
reinterpret_cast<pldm_state_sensor_pdr*>(entry.data());
if (!pdr)
{
- error("Failed to get record by PDR type, ERROR:{ERR_CODE}", "ERR_CODE",
+ error("Failed to get record by PDR type, error - {ERROR}", "ERROR",
lg2::hex, static_cast<unsigned>(PLDM_PLATFORM_INVALID_SENSOR_ID));
return;
}
@@ -321,7 +321,7 @@
if (rc || completionCode)
{
error(
- "Failed to decode_platform_event_message_resp: for code update event rc={RC}, cc={CC}",
+ "Failed to decode platform event message response for code update event with response code '{RC}' and completion code '{CC}'",
"RC", rc, "CC", static_cast<unsigned>(completionCode));
}
};
@@ -376,14 +376,17 @@
instanceId);
if (rc != PLDM_SUCCESS)
{
- error("Failed to encode state sensor event, rc = {RC}", "RC", rc);
+ error("Failed to encode state sensor event with response code '{RC}'",
+ "RC", rc);
instanceIdDb.free(mctp_eid, instanceId);
return;
}
rc = sendEventToHost(requestMsg, instanceId);
if (rc != PLDM_SUCCESS)
{
- error("Failed to send event to host: rc={RC}", "RC", rc);
+ error(
+ "Failed to send event to remote terminus with response code '{RC}'",
+ "RC", rc);
}
return;
}
@@ -464,8 +467,8 @@
catch (const std::exception& e)
{
error(
- "Chassis State transition to Off failed, unable to set property RequestedPowerTransition ERROR={ERR_EXCEP}",
- "ERR_EXCEP", e.what());
+ "Failure in chassis State transition to Off, unable to set property RequestedPowerTransition, error - {ERROR}",
+ "ERROR", e);
}
using namespace sdbusplus::bus::match::rules;
@@ -498,8 +501,8 @@
catch (const std::exception& e)
{
error(
- "Setting one-time restore policy failed, unable to set property PowerRestorePolicy ERROR={ERR_EXCEP}",
- "ERR_EXCEP", e.what());
+ "Failure in setting one-time restore policy, unable to set property PowerRestorePolicy, error - {ERROR}",
+ "ERROR", e);
}
dbusMapping = pldm::utils::DBusMapping{
"/xyz/openbmc_project/state/bmc0",
@@ -513,8 +516,8 @@
catch (const std::exception& e)
{
error(
- "BMC state transition to reboot failed, unable to set property RequestedBMCTransition ERROR={ERR_EXCEP}",
- "ERR_EXCEP", e.what());
+ "Failure in BMC state transition to reboot, unable to set property RequestedBMCTransition , error - {ERROR}",
+ "ERROR", e);
}
}
}
@@ -576,8 +579,7 @@
}
catch (const std::exception& e)
{
- error("Failed To reset watchdog timer ERROR={ERR_EXCEP}", "ERR_EXCEP",
- e.what());
+ error("Failed to reset watchdog timer, error - {ERROR}", "ERROR", e);
return;
}
}
@@ -600,8 +602,7 @@
}
catch (const std::exception& e)
{
- error("Failed To disable watchdog timer ERROR={ERR_EXCEP}", "ERR_EXCEP",
- e.what());
+ error("Failed to disable watchdog timer, error - {ERROR}", "ERROR", e);
}
}
int pldm::responder::oem_ibm_platform::Handler::checkBMCState()
@@ -624,7 +625,8 @@
}
catch (const std::exception& e)
{
- error("Error getting the current BMC state: {ERROR}", "ERROR", e);
+ error("Error getting the current BMC state, error - {ERROR}", "ERROR",
+ e);
return PLDM_ERROR;
}
return PLDM_SUCCESS;
diff --git a/oem/ibm/libpldmresponder/platform_oem_ibm.cpp b/oem/ibm/libpldmresponder/platform_oem_ibm.cpp
index 6f519a2..4ea7b2f 100644
--- a/oem/ibm/libpldmresponder/platform_oem_ibm.cpp
+++ b/oem/ibm/libpldmresponder/platform_oem_ibm.cpp
@@ -57,8 +57,8 @@
catch (const sdbusplus::exception_t& e)
{
error(
- "Error in getting current host state, {EXCEP_NAME} Continue sending the bios attribute update event ...",
- "EXCEP_NAME", e.name());
+ "Error in getting current remote terminus state, error - '{ERROR}' Continue sending the bios attribute update event ...",
+ "ERROR", e);
}
auto instanceId = instanceIdDb->next(eid);
@@ -77,7 +77,7 @@
if (rc != PLDM_SUCCESS)
{
error(
- "BIOS Attribute update event message encode failure. PLDM error code = {RC}",
+ "Failed to encode BIOS Attribute update event message, response code '{RC}'",
"RC", lg2::hex, rc);
instanceIdDb->free(eid, instanceId);
return rc;
@@ -97,7 +97,7 @@
if (rc || completionCode)
{
error(
- "Failed to decode BIOS Attribute update platform_event_message_resp: rc = {RC}, cc= {CC}",
+ "Failed to decode BIOS Attribute update platform event message response with response code '{RC}' and completion code '{CC}'",
"RC", rc, "CC", static_cast<unsigned>(completionCode));
}
};
@@ -107,7 +107,8 @@
if (rc)
{
error(
- "Failed to send BIOS Attribute update the platform event message");
+ "Failed to send BIOS Attribute update the platform event message, response code '{RC}'",
+ "RC", rc);
}
return rc;
diff --git a/oem/ibm/libpldmresponder/utils.cpp b/oem/ibm/libpldmresponder/utils.cpp
index 05978b4..a29a0d4 100644
--- a/oem/ibm/libpldmresponder/utils.cpp
+++ b/oem/ibm/libpldmresponder/utils.cpp
@@ -27,10 +27,12 @@
struct sockaddr_un addr;
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
- if (strnlen(socketInterface.c_str(), sizeof(addr.sun_path)) ==
- sizeof(addr.sun_path))
+ size_t interfaceLength = strnlen(socketInterface.c_str(),
+ sizeof(addr.sun_path));
+ if (interfaceLength == sizeof(addr.sun_path))
{
- error("setupUnixSocket: UNIX socket path too long");
+ error("Setup unix socket path '{PATH}' is too long '{LENGTH}'", "PATH",
+ socketInterface, "LENGTH", interfaceLength);
return -1;
}
@@ -38,21 +40,21 @@
if ((sock = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0)) == -1)
{
- error("setupUnixSocket: socket() call failed");
+ error("Failed to open unix socket");
return -1;
}
if (bind(sock, (struct sockaddr*)&addr, sizeof(addr)) == -1)
{
- error("setupUnixSocket: bind() call failed with errno {ERR}", "ERR",
- errno);
+ error("Failed to bind unix socket, error number - {ERROR_NUM}",
+ "ERROR_NUM", errno);
close(sock);
return -1;
}
if (listen(sock, 1) == -1)
{
- error("setupUnixSocket: listen() call failed");
+ error("Failed listen() call while setting up unix socket");
close(sock);
return -1;
}
@@ -70,7 +72,9 @@
int retval = select(nfd, &rfd, NULL, NULL, &tv);
if (retval < 0)
{
- error("setupUnixSocket: select call failed {ERR}", "ERR", errno);
+ error(
+ "Failed select() call while setting up unix socket, error number - {ERROR_NUM}",
+ "ERROR_NUM", errno);
close(sock);
return -1;
}
@@ -80,7 +84,9 @@
fd = accept(sock, NULL, NULL);
if (fd < 0)
{
- error("setupUnixSocket: accept() call failed {ERR}", "ERR", errno);
+ error(
+ "Failed accept() call while setting up unix socket, error number - {ERROR_NUM}",
+ "ERROR_NUM", errno);
close(sock);
return -1;
}
@@ -108,7 +114,9 @@
int retval = select(nfd, NULL, &wfd, NULL, &tv);
if (retval < 0)
{
- error("writeToUnixSocket: select call failed {ERR}", "ERR", errno);
+ error(
+ "Failed to write to unix socket select, error number - {ERROR_NUM}",
+ "ERROR_NUM", errno);
close(sock);
return -1;
}
@@ -125,11 +133,14 @@
if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)
{
error(
- "writeToUnixSocket: Write call failed with EAGAIN or EWOULDBLOCK or EINTR");
+ "Failed to write to unix socket, error number - {ERROR_NUM}",
+ "ERROR_NUM", errno);
nwrite = 0;
continue;
}
- error("writeToUnixSocket: Failed to write {ERR}", "ERR", errno);
+ error(
+ "Failed to write to unix socket, error number - {ERROR_NUM}",
+ "ERROR_NUM", errno);
close(sock);
return -1;
}
diff --git a/oem/ibm/requester/dbus_to_file_handler.cpp b/oem/ibm/requester/dbus_to_file_handler.cpp
index 7f15103..19b3e6b 100644
--- a/oem/ibm/requester/dbus_to_file_handler.cpp
+++ b/oem/ibm/requester/dbus_to_file_handler.cpp
@@ -54,7 +54,8 @@
if (rc != PLDM_SUCCESS)
{
instanceIdDb->free(mctp_eid, instanceId);
- error("Failed to encode_new_file_req, rc = {RC}", "RC", rc);
+ error("Failed to encode new file request with response code '{RC}'",
+ "RC", rc);
return;
}
@@ -71,7 +72,7 @@
if (rc || completionCode)
{
error(
- "Failed to decode_new_file_resp or Host returned error for new_file_available rc={RC}, cc = {CC}",
+ "Failed to decode new file available response or remote terminus returned error, response code '{RC}' and completion code '{CC}'",
"RC", rc, "CC", static_cast<unsigned>(completionCode));
reportResourceDumpFailure();
}
@@ -81,7 +82,9 @@
std::move(requestMsg), std::move(newFileAvailableRespHandler));
if (rc)
{
- error("Failed to send NewFileAvailable Request to Host");
+ error(
+ "Failed to send NewFileAvailable Request to Host, response code '{RC}'",
+ "RC", rc);
reportResourceDumpFailure();
}
}
@@ -99,8 +102,8 @@
}
catch (const std::exception& e)
{
- error("failed to set resource dump operation status, ERROR={ERR_EXCEP}",
- "ERR_EXCEP", e.what());
+ error("Failed to set resource dump operation status, error - {ERROR}",
+ "ERROR", e);
}
}
@@ -123,9 +126,8 @@
catch (const sdbusplus::exception_t& e)
{
error(
- "Error {ERR_EXCEP} found in getting current resource dump status while initiating a new resource dump with objPath={DUMP_OBJ_PATH} and intf={DUMP_PROG_INTF}",
- "ERR_EXCEP", e.what(), "DUMP_OBJ_PATH",
- resDumpCurrentObjPath.str.c_str(), "DUMP_PROG_INTF",
+ "Error '{ERROR}' found in getting current resource dump status while initiating a new resource dump with object path '{PATH}' and interface {INTERFACE}",
+ "ERROR", e, "PATH", resDumpCurrentObjPath, "INTERFACE",
resDumpProgressIntf);
}
@@ -146,7 +148,7 @@
if (!fileHandle)
{
- error("resource dump file open error:{RES_DUMP_PATH}", "RES_DUMP_PATH",
+ error("Failed to open resource dump file '{PATH}'", "PATH",
resDumpFilePath);
PropertyValue value{resDumpStatus};
DBusMapping dbusMapping{resDumpCurrentObjPath, resDumpProgressIntf,
@@ -158,8 +160,8 @@
catch (const std::exception& e)
{
error(
- "failed to set resource dump operation status, ERROR={ERR_EXCEP}",
- "ERR_EXCEP", e.what());
+ "Failed to set resource dump operation status, error - {ERROR}",
+ "ERROR", e);
}
return;
}
@@ -224,8 +226,7 @@
if (!certFile)
{
- error("cert file open error: {CERT_PATH}", "CERT_PATH",
- certFilePath.c_str());
+ error("Failed to open certificate file '{PATH}'", "PATH", certFilePath);
return;
}
@@ -245,7 +246,7 @@
{
if (instanceIdDb == NULL)
{
- error("Failed to send csr to host.");
+ error("Failed to send csr to remote terminus.");
pldm::utils::reportError(
"xyz.openbmc_project.bmc.pldm.InternalFailure");
return;
@@ -260,7 +261,8 @@
if (rc != PLDM_SUCCESS)
{
instanceIdDb->free(mctp_eid, instanceId);
- error("Failed to encode_new_file_req, rc = {RC}", "RC", rc);
+ error("Failed to encode new file request with response code '{RC}'",
+ "RC", rc);
return;
}
auto newFileAvailableRespHandler =
@@ -276,7 +278,7 @@
if (rc || completionCode)
{
error(
- "Failed to decode_new_file_resp for vmi, or Host returned error for new_file_available rc = {RC}, cc = {CC}",
+ "Failed to decode new file available response for vmi or remote terminus returned error, response code '{RC}' and completion code '{CC}'",
"RC", rc, "CC", static_cast<unsigned>(completionCode));
pldm::utils::reportError(
"xyz.openbmc_project.bmc.pldm.InternalFailure");
@@ -287,7 +289,9 @@
std::move(requestMsg), std::move(newFileAvailableRespHandler));
if (rc)
{
- error("Failed to send NewFileAvailable Request to Host for vmi");
+ error(
+ "Failed to send NewFileAvailable Request to Host for vmi, response code '{RC}'",
+ "RC", rc);
pldm::utils::reportError(
"xyz.openbmc_project.bmc.pldm.InternalFailure");
}