Logging and reporting unhandled exceptions