Implemented: Method to log exceptions.