openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Shawn McCarney <shawnmm@linux.vnet.ibm.com>
To: openbmc@lists.ozlabs.org
Subject: Easier way to create error logs with FFDC
Date: Tue, 3 Nov 2020 10:35:46 -0600	[thread overview]
Message-ID: <335508c6-a7be-a161-71fb-b0502418dd5b@linux.vnet.ibm.com> (raw)

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


                 reply	other threads:[~2020-11-03 16:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=335508c6-a7be-a161-71fb-b0502418dd5b@linux.vnet.ibm.com \
    --to=shawnmm@linux.vnet.ibm.com \
    --cc=openbmc@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).