Added thread id to log. Added logging of function entry and exit.