Ignore Errors and Write Log Message?

Hello Group,

how can I ignore errors for one task (ignore_errors: yes) and if there was an error write
a log message (e.g. debug task) ?

Thanks,
Dennis Benzinger | SAP Hybris

- task1:
  ignore_errors: yes
  register: task1_results

- debug: msg='lola'
  when: task1_results|failed