Merge debug logging from the hotfixes branch.