Fix race condition in AMQP logging.