Added logging on the main thread.