add optional thread id logging