Improved logging to remove printstacktrace