You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2009/10/02 18:00:18 UTC

svn commit: r821070 - /qpid/trunk/qpid/cpp/src/qpidd.cpp

Author: aconway
Date: Fri Oct  2 16:00:17 2009
New Revision: 821070

URL: http://svn.apache.org/viewvc?rev=821070&view=rev
Log:
qpidd prints message to stderr if logging configuration is invalid.

It used to exit silently.

Modified:
    qpid/trunk/qpid/cpp/src/qpidd.cpp

Modified: qpid/trunk/qpid/cpp/src/qpidd.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpidd.cpp?rev=821070&r1=821069&r2=821070&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpidd.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpidd.cpp Fri Oct  2 16:00:17 2009
@@ -36,25 +36,29 @@
 {
     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



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org