logging now is always dispatched to the main thread, to cover the case that this method is called from another thread.