add plugin interface to check log control
[platform/core/dotnet/launcher.git] / NativeLauncher / launcher / dotnet / dotnet_launcher.cc
index 2e65927..884a5a2 100644 (file)
@@ -136,6 +136,12 @@ CoreRuntime::CoreRuntime(const char* mode) :
        if (initializePluginManager(mode) < 0) {
                _ERR("Failed to initialize PluginManager");
        }
+
+       if (pluginHasLogControl()) {
+               __enableLogManager = false;
+       } else {
+               __enableLogManager = true;
+       }
 }
 
 CoreRuntime::~CoreRuntime()
@@ -177,19 +183,21 @@ int CoreRuntime::initialize(bool standalone)
                return -1;
        }
 
-       if (initializeLogManager() < 0) {
-               _ERR("Failed to initnialize LogManager");
-               return -1;
-       }
+       if (__enableLogManager) {
+               if (initializeLogManager() < 0) {
+                       _ERR("Failed to initnialize LogManager");
+                       return -1;
+               }
 
-       if (redirectFD() < 0) {
-               _ERR("Failed to redirect FD");
-               return -1;
-       }
+               if (redirectFD() < 0) {
+                       _ERR("Failed to redirect FD");
+                       return -1;
+               }
 
-       if (runLoggingThread() < 0) {
-               _ERR("Failed to create and run logging thread to redicrect log");
-               return -1;
+               if (runLoggingThread() < 0) {
+                       _ERR("Failed to create and run logging thread to redicrect log");
+                       return -1;
+               }
        }
 
        std::string libCoreclr(concatPath(getRuntimeDir(), "libcoreclr.so"));
@@ -327,11 +335,13 @@ int CoreRuntime::launch(const char* appId, const char* root, const char* path, i
                return -1;
        }
 
-       // launchpad override stdout and stderr to journalctl before launch application.
-       // we have to re-override that to input pipe for logging thread.
-       if (redirectFD() < 0) {
-               _ERR("Failed to redirect FD");
-               return -1;
+       if (__enableLogManager) {
+               // launchpad override stdout and stderr to journalctl before launch application.
+               // we have to re-override that to input pipe for logging thread.
+               if (redirectFD() < 0) {
+                       _ERR("Failed to redirect FD");
+                       return -1;
+               }
        }
 
        pluginSetAppInfo(appId, path);