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.