Fixed race condition when initializing the logger by making it fully thread-safe