Просмотр исходного кода

main: use syslog & printf directly for early log messages

libqb seems funny about logging things before its fully configured.
This corosync commit didn't help either:
8b6bd86a55b8bda9f3a8ff67bdff908263976fa3

So to make sure that messages about the config file not being opened
get delivered to the user/syslog we send them directly.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Christine Caulfield 8 лет назад
Родитель
Сommit
01495f650c
1 измененных файлов с 8 добавлено и 2 удалено
  1. 8 2
      exec/main.c

+ 8 - 2
exec/main.c

@@ -1288,12 +1288,18 @@ int main (int argc, char **argv, char **envp)
 
 	res = coroparse_configparse(icmap_get_global_map(), &error_string);
 	if (res == -1) {
-		log_printf (LOGSYS_LEVEL_ERROR, "%s", error_string);
+		/*
+		 * Logsys can't log properly at this early stage, and we need to get this message out
+		 *
+		 */
+		fprintf (stderr, "%s\n", error_string);
+		syslog (LOGSYS_LEVEL_ERROR, "%s", error_string);
 		corosync_exit_error (COROSYNC_DONE_MAINCONFIGREAD);
 	}
 
 	if (stats_map_init(api) != CS_OK) {
-		log_printf (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't initialize statistics component.");
+		fprintf (stderr, "Corosync Executive couldn't initialize statistics component.\n");
+		syslog (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't initialize statistics component.");
 		corosync_exit_error (COROSYNC_DONE_STATS);
 	}