Improve logging
Improve logging in case of failure. Target output is sent to debug logging stream