Close #23429. Coerce `WSGIRequestHandler` log messages to `str`

Could we patch a StringIO instead of devnull and then verify the contents of log_message()? See tests/check_framework/tests.py for an example. Also the patching should be in setUp/tearDown or in a try/finally so if something goes wrong the unpatching still happens.