Fix some inference problems in logging (#38292)
These appear to trigger the only non-pirating remaining sources of vulnerability to
invalidation of `Base.require` among Julia's *exported* names,
which are the main names we can expect to be specialized by packages.