If you need log output in tests, you should use an instance of a logger.
More teams should be validating their logging and should be leveraging structured logging and getting valuable logging insights/events.