Fixes #3101: Improved handling of log target failures

This one is to fix #3101, many debug toolbar failures and improve logging in general. It will now skip target and log reason instead of going into infinite cycle.
isn't this still an infinite loop when the logged warning will result in this target and it fails again? need some fallback logging maybe use `error_log` only.