diff options
author | Alan Conway <aconway@apache.org> | 2009-10-02 16:00:17 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2009-10-02 16:00:17 +0000 |
commit | cc6ec1079431b7eb45031d36f5a6ad5e9a6675ac (patch) | |
tree | 0870f8c7aa48b06df79eb845db8f44fde87e9f18 | |
parent | 31dbd26d81d3aa7b27616e13c30687f0d012711e (diff) | |
download | qpid-python-cc6ec1079431b7eb45031d36f5a6ad5e9a6675ac.tar.gz |
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
-rw-r--r-- | cpp/src/qpidd.cpp | 34 |
1 files 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<string>::iterator iter = bootOptions.module.load.begin(); - iter != bootOptions.module.load.end(); - iter++) - qpid::tryShlib (iter->data(), false); + for (vector<string>::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 |