better implementation of logging thread with blocking queue.