Use custom logging.
Log to thread.
Only use one thread for logging.