Improved exceptions logging