Easier way to create error logs with FFDC

Shawn McCarney shawnmm at linux.vnet.ibm.com
Wed Nov 4 03:35:46 AEDT 2020


Hi,

The D-Bus method CreateWithFFDCFiles can be used to create error log 
entries with First Failure Data Capture (FFDC) information. See 
https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/xyz/openbmc_project/Logging/Create.interface.yaml#L32

Using this D-Bus method is a bit tricky because you need to pass in file 
descriptors to temporary files containing the FFDC data. So you need to 
create the temporary files with sufficiently unique names, and after the 
method is complete you need to close the file descriptors and delete the 
temporary files.  Obviously cleanup needs to happen on both good paths 
and error/exception paths.  If you have multiple FFDC files, you also 
need safe move semantics to put the information in a standard collection 
like vector.

I wrote a C++ class named FFDCFile to make calling this D-Bus method 
simpler.  It handles the problems above and has gtests to test it.  You 
can see the code here: 
https://github.com/openbmc/phosphor-power/blob/master/phosphor-regulators/src/ffdc_file.hpp 
.  It uses TemporaryFile and FileDescriptor utility classes.

Would there be interest it making this available in the phosphor-logging 
repository so it could be used by others?

Thanks,

Shawn



More information about the openbmc mailing list