Adding thread id into the logging

Trying to make it easier to trace and understand the issue with the
double free