add logging to otimizing failed