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.
@klimov-paul yes, it could be. Probably worth moving all this handling to `yii\log\Dispatcher::dispatch()`.