From 148105046dc56c003eca739659c5fd0805b2be8e Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 6 Feb 2018 12:56:44 -0600 Subject: [PATCH] global/global_init: send startup errors to cerr, not log (Flush the log, too, as something that has useful error messages.) Signed-off-by: Sage Weil --- src/global/global_init.cc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/global/global_init.cc b/src/global/global_init.cc index a7b103da499..a990d5d3e7d 100644 --- a/src/global/global_init.cc +++ b/src/global/global_init.cc @@ -114,24 +114,25 @@ void global_pre_init( int ret = conf->parse_config_files(c_str_or_null(conf_file_list), &cerr, flags); if (ret == -EDOM) { - dout_emergency("global_init: error parsing config file.\n"); + cct->_log->flush(); + cerr << "global_init: error parsing config file." << std::endl; _exit(1); } else if (ret == -ENOENT) { if (!(flags & CINIT_FLAG_NO_DEFAULT_CONFIG_FILE)) { if (conf_file_list.length()) { - ostringstream oss; - oss << "global_init: unable to open config file from search list " - << conf_file_list << "\n"; - dout_emergency(oss.str()); + cct->_log->flush(); + cerr << "global_init: unable to open config file from search list " + << conf_file_list << std::endl; _exit(1); } else { - derr << "did not load config file, using default settings." << dendl; + cerr << "did not load config file, using default settings." << std::endl; } } } else if (ret) { - dout_emergency("global_init: error reading config file.\n"); + cct->_log->flush(); + cerr << "global_init: error reading config file." << std::endl; _exit(1); } @@ -147,8 +148,9 @@ void global_pre_init( MonClient mc_bootstrap(g_ceph_context); if (mc_bootstrap.get_monmap_and_config() < 0) { - derr << "failed to fetch mon config (--no-mon-config to skip)" << dendl; cct->_log->flush(); + cerr << "failed to fetch mon config (--no-mon-config to skip)" + << std::endl; _exit(1); } } -- 2.39.5