Improved logging when insert fails