void plugin_preload();
/**
+ * @brief check whether plugin controls output log or not.
+ * @return true if plugin control logging, otherwise false
+ */
+ bool plugin_has_log_control();
+
+ /**
* @brief set appInfo to plugin
* @param[in] appID application ID to launch
* @param[in] assemblyPath assembly path which has entry point
typedef void (*plugin_set_app_info_ptr)(
const char* appId,
const char* managedAssemblyPath);
+typedef bool (*plugin_has_log_control_ptr)();
typedef void (*plugin_set_coreclr_info_ptr)(
void* hostHandle,
unsigned int domainId,
typedef struct PluginFunc {
plugin_initialize_ptr initialize;
plugin_preload_ptr preload;
+ plugin_has_log_control_ptr has_log_control;
plugin_set_app_info_ptr set_app_info;
plugin_set_coreclr_info_ptr set_coreclr_info;
plugin_get_dll_path_ptr get_dll_path;
// plugin functions
void pluginPreload();
+bool pluginHasLogControl();
void pluginSetAppInfo(const char* appId, const char* managedAssemblyPath);
void pluginSetCoreclrInfo(void* hostHandle, unsigned int domainId, coreclr_create_delegate_ptr delegateFunc);
char* pluginGetDllPath();
if (initializePluginManager(mode) < 0) {
_ERR("Failed to initialize PluginManager");
}
+
+ if (pluginHasLogControl()) {
+ __enableLogManager = false;
+ } else {
+ __enableLogManager = true;
+ }
}
CoreRuntime::~CoreRuntime()
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"));
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);
unsigned int __domainId;
int fd;
bool __initialized;
+ bool __enableLogManager;
};
} // dotnetcore
}
__pluginFunc->initialize = (plugin_initialize_ptr)dlsym(__pluginLib, "plugin_initialize");
__pluginFunc->preload = (plugin_preload_ptr)dlsym(__pluginLib, "plugin_preload");
+ __pluginFunc->has_log_control = (plugin_has_log_control_ptr)dlsym(__pluginLib, "plugin_has_log_control");
__pluginFunc->set_app_info = (plugin_set_app_info_ptr)dlsym(__pluginLib, "plugin_set_app_info");
__pluginFunc->set_coreclr_info = (plugin_set_coreclr_info_ptr)dlsym(__pluginLib, "plugin_set_coreclr_info");
__pluginFunc->get_dll_path = (plugin_get_dll_path_ptr)dlsym(__pluginLib, "plugin_get_dll_path");
}
}
+bool pluginHasLogControl()
+{
+ if (__pluginFunc && __pluginFunc->has_log_control) {
+ return __pluginFunc->has_log_control();
+ } else {
+ return false;
+ }
+}
+
void pluginSetAppInfo(const char* appId, const char* managedAssemblyPath)
{
if (__pluginFunc && __pluginFunc->set_app_info) {