Added logging for upsert behavior