openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Easier way to create error logs with FFDC
@ 2020-11-03 16:35 Shawn McCarney
  0 siblings, 0 replies; only message in thread
From: Shawn McCarney @ 2020-11-03 16:35 UTC (permalink / raw)
  To: openbmc

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-03 16:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-03 16:35 Easier way to create error logs with FFDC Shawn McCarney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).