Skip to content

Commit

Permalink
ceph-osdomap-tool: Add --debug and only show internal logging if enabled
Browse files Browse the repository at this point in the history
Signed-off-by: David Zafman <dzafman@redhat.com>
  • Loading branch information
dzafman committed Mar 27, 2017
1 parent fcf1e17 commit 5fb2b2d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/tools/ceph_osdomap_tool.cc
Expand Up @@ -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<string>(&store_path),
"path to mon directory, mandatory (current/omap usually)")
("paranoid", "use paranoid checking")
("debug", "Additional debug output from DBObjectMap")
("oid", po::value<string>(&oid), "Restrict to this object id when dumping objects")
("command", po::value<string>(&cmd),
"command arg is one of [dump-raw-keys, dump-raw-key-vals, dump-objects, dump-objects-with-keys, check, dump-headers], mandatory")
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 5fb2b2d

Please sign in to comment.