Made NLog logging and ClientAPI logging in tests more robust to diagnose problems.