-added lock around logging statement