Since a crash in handle_event is so disasterous, and since gen_event handlers are not very supervisable, let's wrap everything in a try/catch. Prinitng to stdout is not great but we just failed to log properly - better to give some indication than none.
Merge bug26236 again