DrussGT and Neuromancer both do this at the top level to log any exceptions to file. You can look at them for examples. They don't however read any data back.
Well, I’m also doing this after experencing some higgs-bugson.