Added logging to 500 & 404 errors.