https://bugs.internet2.edu/jira/browse/CPPOST-57
authorcantor <cantor@fb386ef7-a10c-0410-8ebf-fd3f8e989ab0>
Mon, 15 Nov 2010 22:04:36 +0000 (22:04 +0000)
committercantor <cantor@fb386ef7-a10c-0410-8ebf-fd3f8e989ab0>
Mon, 15 Nov 2010 22:04:36 +0000 (22:04 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-opensaml2/branches/REL_2@614 fb386ef7-a10c-0410-8ebf-fd3f8e989ab0

saml/saml2/metadata/impl/XMLMetadataProvider.cpp

index 961cff6..57bb4cf 100644 (file)
 #include <xmltooling/util/Threads.h>
 #include <xmltooling/validation/ValidatorSuite.h>
 
+#if defined(OPENSAML_LOG4SHIB)
+# include <log4shib/NDC.hh>
+#elif defined(OPENSAML_LOG4CPP)
+# include <log4cpp/NDC.hh>
+#endif
+
 using namespace opensaml::saml2md;
 using namespace xmltooling::logging;
 using namespace xmltooling;
@@ -62,13 +68,25 @@ namespace opensaml {
 
             void init() {
                 try {
+                    if (!m_id.empty()) {
+                        string threadid("[");
+                        threadid += m_id + ']';
+                        logging::NDC::push(threadid);
+                    }
                     background_load();
                     startup();
                 }
                 catch (...) {
                     startup();
+                    if (!m_id.empty()) {
+                        logging::NDC::pop();
+                    }
                     throw;
                 }
+
+                if (!m_id.empty()) {
+                    logging::NDC::pop();
+                }
             }
 
             const XMLObject* getMetadata() const {