Add logging support to try and track down crashes