Setup log target right after starting plugin for more debugging 93/192193/3 accepted/tizen/unified/20181108.074505 accepted/tizen/unified/20190128.061317 submit/tizen/20181106.232739 submit/tizen/20190121.010243
authorYoungHun Kim <yh8004.kim@samsung.com>
Wed, 31 Oct 2018 10:37:43 +0000 (19:37 +0900)
committerYoungHun Kim <yh8004.kim@samsung.com>
Fri, 2 Nov 2018 07:56:29 +0000 (16:56 +0900)
 - replace with printf before setup target

Change-Id: I091e774092954e782694ed6fc89ebb27957977e7

src/common/log.c
src/daemon/daemon.c

index 1e32172090af1daa3c5effbc4459cafd94aacd89..3b60659c69a0925f953bd1c760aae9ab6c37791e 100644 (file)
@@ -226,6 +226,7 @@ int mrp_log_set_target(const char *name)
     }
 
     log_target = target;
+    mrp_log_info("murphyd %s start", mrp_log_get_target());
 
     /* open any new files if we have to */
     if (target == &file_target) {
index 8df12b0582dca24927d697d67c50375b6f3fd2e0..293610c888c10f9cc41958528afed07e9f216fd5 100644 (file)
@@ -102,10 +102,11 @@ static mrp_context_t *create_context(void)
 
     if (ctx != NULL) {
         ctx->daemon_bus = mrp_event_bus_get(ctx->ml, MRP_DAEMON_BUS);
+        printf("Success to create murphy main context\n");
         return ctx;
     }
     else
-        mrp_log_error("Failed to create murphy main context.");
+        printf("Failed to create murphy main context.\n");
 
     exit(1);
 }
@@ -134,28 +135,28 @@ static void load_configuration(mrp_context_t *ctx)
     cfg = mrp_parse_cfgfile(ctx->config_file);
 
     if (cfg != NULL) {
-        mrp_log_info("Blacklisted plugins of any type: %s",
+        printf("Blacklisted plugins of any type: %s\n",
                      ctx->blacklist_plugins ? ctx->blacklist_plugins:"<none>");
-        mrp_log_info("Blacklisted builtin plugins: %s",
+        printf("Blacklisted builtin plugins: %s\n",
                      ctx->blacklist_builtin ? ctx->blacklist_builtin:"<none>");
-        mrp_log_info("Blacklisted dynamic plugins: %s",
+        printf("Blacklisted dynamic plugins: %s\n",
                      ctx->blacklist_dynamic ? ctx->blacklist_dynamic:"<none>");
-        mrp_log_info("Whitelisted plugins of any type: %s",
+        printf("Whitelisted plugins of any type: %s\n",
                      ctx->whitelist_plugins ? ctx->whitelist_plugins:"<none>");
-        mrp_log_info("Whitelisted builtin plugins: %s",
+        printf("Whitelisted builtin plugins: %s\n",
                      ctx->whitelist_builtin ? ctx->whitelist_builtin:"<none>");
-        mrp_log_info("Whitelisted dynamic plugins: %s",
+        printf("Whitelisted dynamic plugins: %s\n",
                      ctx->whitelist_dynamic ? ctx->whitelist_dynamic:"<none>");
 
         mrp_block_blacklisted_plugins(ctx);
 
         if (!mrp_exec_cfgfile(ctx, cfg)) {
-            mrp_log_error("Failed to execute configuration.");
+            printf("Failed to execute configuration.\n");
             exit(1);
         }
     }
     else {
-        mrp_log_error("Failed to parse configuration file '%s'.",
+        printf("Failed to parse configuration file '%s'.\n",
                       ctx->config_file);
         exit(1);
     }
@@ -189,9 +190,9 @@ static void start_plugins(mrp_context_t *ctx)
     emit_daemon_event(ctx, DAEMON_EVENT_STARTING);
 
     if (mrp_start_plugins(ctx))
-        mrp_log_info("Successfully started all loaded plugins.");
+        printf("Successfully started all loaded plugins.\n");
     else {
-        mrp_log_error("Some plugins failed to start.");
+        printf("Some plugins failed to start.\n");
         exit(1);
     }
 }
@@ -288,9 +289,9 @@ int main(int argc, char *argv[], char *envp[])
     parse_cmdline(ctx, argc, argv, envp);
     load_configuration(ctx);
     start_plugins(ctx);
+    setup_logging(ctx);
     load_ruleset(ctx);
     prepare_ruleset(ctx);
-    setup_logging(ctx);
     set_linebuffered(stdout);
     set_nonbuffered(stderr);
     daemonize(ctx);