Logging fixes

Updated from #8241