Added wait_fo_logging_to_finish() and related bits, so the analysis functions won't timeout and instead give a progress report while the mailbox clears.