From cc6ec1079431b7eb45031d36f5a6ad5e9a6675ac Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Fri, 2 Oct 2009 16:00:17 +0000 Subject: qpidd prints message to stderr if logging configuration is invalid. It used to exit silently. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@821070 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpidd.cpp | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/cpp/src/qpidd.cpp b/cpp/src/qpidd.cpp index 1839a62205..f2b46942fb 100644 --- a/cpp/src/qpidd.cpp +++ b/cpp/src/qpidd.cpp @@ -36,25 +36,29 @@ int main(int argc, char* argv[]) { try { - { - BootstrapOptions bootOptions(argv[0]); - string defaultPath (bootOptions.module.loadDir); - // Parse only the common, load, and log options to see which - // modules need to be loaded. Once the modules are loaded, - // the command line will be re-parsed with all of the - // module-supplied options. + BootstrapOptions bootOptions(argv[0]); + string defaultPath (bootOptions.module.loadDir); + // Parse only the common, load, and log options to see which + // modules need to be loaded. Once the modules are loaded, + // the command line will be re-parsed with all of the + // module-supplied options. + try { bootOptions.parse (argc, argv, bootOptions.common.config, true); qpid::log::Logger::instance().configure(bootOptions.log); + } catch (const std::exception& e) { + // Couldn't configure logging so write the message direct to stderr. + cerr << "Unexpected error: " << e.what() << endl; + return 1; + } - for (vector::iterator iter = bootOptions.module.load.begin(); - iter != bootOptions.module.load.end(); - iter++) - qpid::tryShlib (iter->data(), false); + for (vector::iterator iter = bootOptions.module.load.begin(); + iter != bootOptions.module.load.end(); + iter++) + qpid::tryShlib (iter->data(), false); - if (!bootOptions.module.noLoad) { - bool isDefault = defaultPath == bootOptions.module.loadDir; - qpid::loadModuleDir (bootOptions.module.loadDir, isDefault); - } + if (!bootOptions.module.noLoad) { + bool isDefault = defaultPath == bootOptions.module.loadDir; + qpid::loadModuleDir (bootOptions.module.loadDir, isDefault); } // Parse options -- cgit v1.2.1