diff --git a/Applications/CLI/ogs.cpp b/Applications/CLI/ogs.cpp
index ae776deed2aa914b73aed0cb7783c36aa437f113..55d0b5abc95b62a160bf7934de00805997b5f45a 100644
--- a/Applications/CLI/ogs.cpp
+++ b/Applications/CLI/ogs.cpp
@@ -53,22 +53,10 @@ void enableFloatingPointExceptions()
 }
 #endif  // _WIN32
 
-void setConsoleLogLevel(std::string const& log_level)
-{
-    BaseLib::setConsoleLogLevel(log_level);
-    spdlog::set_pattern("%^%l:%$ %v");
-    spdlog::set_error_handler(
-        [](const std::string& msg)
-        {
-            std::cerr << "spdlog error: " << msg << std::endl;
-            OGS_FATAL("spdlog logger error occurred.");
-        });
-}
-
 int main(int argc, char* argv[])
 {
     CommandLineArgumentParser cli_arg(argc, argv);
-    setConsoleLogLevel(cli_arg.log_level);
+    BaseLib::initOGSLogger(cli_arg.log_level);
 #ifndef _WIN32  // TODO: On windows floating point exceptions are not handled
     if (cli_arg.enable_fpe_is_set)
     {
diff --git a/BaseLib/Logging.cpp b/BaseLib/Logging.cpp
index 00ff5f985664a821255c7f98d5d103e3bf90ac52..7edada2ec5a478da36dac185aaa08ca351ae39f9 100644
--- a/BaseLib/Logging.cpp
+++ b/BaseLib/Logging.cpp
@@ -14,6 +14,7 @@
 #include <spdlog/sinks/stdout_color_sinks.h>
 #include <spdlog/spdlog.h>
 
+#include <iostream>
 #include <map>
 
 #ifdef USE_PETSC
@@ -47,4 +48,16 @@ void setConsoleLogLevel(std::string const& level_string)
     console->set_level(level->second);
     spdlog::set_default_logger(console);
 }
+
+void initOGSLogger(std::string const& log_level)
+{
+    BaseLib::setConsoleLogLevel(log_level);
+    spdlog::set_pattern("%^%l:%$ %v");
+    spdlog::set_error_handler(
+        [](const std::string& msg)
+        {
+            std::cerr << "spdlog error: " << msg << std::endl;
+            OGS_FATAL("spdlog logger error occurred.");
+        });
+}
 }  // namespace BaseLib
diff --git a/BaseLib/Logging.h b/BaseLib/Logging.h
index f2de07f271db5338befd4facb821b60315809c03..65db2c393d75f75282f533f62c63ec019b6a87e4 100644
--- a/BaseLib/Logging.h
+++ b/BaseLib/Logging.h
@@ -22,7 +22,7 @@ namespace BaseLib
 {
 extern BASELIB_EXPORT std::shared_ptr<spdlog::logger> console;
 void setConsoleLogLevel(std::string const& level_string);
-
+void initOGSLogger(std::string const& log_level);
 }  // namespace BaseLib
 
 template <typename... Args>