From ef5aeab9b22292c366489668ee21ce4b9d2d8572 Mon Sep 17 00:00:00 2001 From: David Zafman Date: Wed, 8 Feb 2017 18:56:27 -0800 Subject: [PATCH] ceph-osdomap-tool: Add --debug and only show internal logging if enabled Signed-off-by: David Zafman (cherry picked from commit 5fb2b2d13953979e5da9f571ab8c4b0b510b8368) --- src/tools/ceph_osdomap_tool.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/tools/ceph_osdomap_tool.cc b/src/tools/ceph_osdomap_tool.cc index f760b0a554cd5..21385b3e79b2f 100644 --- a/src/tools/ceph_osdomap_tool.cc +++ b/src/tools/ceph_osdomap_tool.cc @@ -28,11 +28,13 @@ using namespace std; int main(int argc, char **argv) { po::options_description desc("Allowed options"); string store_path, cmd, out_path, oid; + bool debug = false; desc.add_options() ("help", "produce help message") ("omap-path", po::value(&store_path), "path to mon directory, mandatory (current/omap usually)") ("paranoid", "use paranoid checking") + ("debug", "Additional debug output from DBObjectMap") ("oid", po::value(&oid), "Restrict to this object id when dumping objects") ("command", po::value(&cmd), "command arg is one of [dump-raw-keys, dump-raw-key-vals, dump-objects, dump-objects-with-keys, check, dump-headers], mandatory") @@ -65,12 +67,19 @@ int main(int argc, char **argv) { ceph_options.push_back(i->c_str()); } + if (vm.count("debug")) debug = true; + auto cct = global_init( &def_args, ceph_options, CEPH_ENTITY_TYPE_OSD, - CODE_ENVIRONMENT_UTILITY, 0); + CODE_ENVIRONMENT_UTILITY_NODOUT, 0); common_init_finish(g_ceph_context); g_ceph_context->_conf->apply_changes(NULL); g_conf = g_ceph_context->_conf; + if (debug) { + g_conf->set_val_or_die("log_to_stderr", "true"); + g_conf->set_val_or_die("err_to_stderr", "true"); + } + g_conf->apply_changes(NULL); if (vm.count("help")) { std::cerr << desc << std::endl; -- 2.39.5