Redirect uncaught events to custom error handler, and enable error logging by default.