core: Make logger thread-safe

Change-Id: Ic45dc0912da9c2e3f074d3f74921bfe33741bf63
Refs: #2489
diff --git a/tests/core/logger.cpp b/tests/core/logger.cpp
index 9ae7fa4..50df279 100644
--- a/tests/core/logger.cpp
+++ b/tests/core/logger.cpp
@@ -864,6 +864,24 @@
     }
 }
 
+BOOST_FIXTURE_TEST_CASE(LoggerFactoryListModules, LoggerFixture)
+{
+  std::set<std::string> testCaseLoggers{"LoggerFactoryListModules1", "LoggerFactoryListModules2"};
+
+  for (const auto& name : testCaseLoggers) {
+    LoggerFactory::create(name);
+  }
+
+  auto&& modules = LoggerFactory::getInstance().getModules();
+  BOOST_CHECK_GE(modules.size(), 2);
+
+  for (const auto& name : modules) {
+    testCaseLoggers.erase(name);
+  }
+
+  BOOST_CHECK_EQUAL(testCaseLoggers.size(), 0);
+}
+
 BOOST_AUTO_TEST_SUITE_END()
 
 } // namespace tests