DEV: Skip logging in test environment (PR #14971)

It adds unnecessary noise when running the test suite.

GitHub