Modified the wait_for_logging to loop more tightly for short queues.