bpo-41739: Fix test_logging.test_race_between_set_target_and_flush() (GH-22655)

The test now waits until all threads complete to avoid leaking
running threads.

Also, use regular threads rather than daemon threads.
2 files changed