Write the error message to log.