From: Scott Cantor Date: Sat, 17 Feb 2007 22:50:05 +0000 (+0000) Subject: Add logging. X-Git-Tag: 2.0-alpha1~84 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-opensaml.git;a=commitdiff_plain;h=dfa608c48f39f8f0764430d571e6000c5fde71a4 Add logging. --- diff --git a/saml/saml2/metadata/impl/ChainingMetadataProvider.cpp b/saml/saml2/metadata/impl/ChainingMetadataProvider.cpp index f3b23f8..de5eb81 100644 --- a/saml/saml2/metadata/impl/ChainingMetadataProvider.cpp +++ b/saml/saml2/metadata/impl/ChainingMetadataProvider.cpp @@ -24,6 +24,7 @@ #include "exceptions.h" #include "saml2/metadata/ChainingMetadataProvider.h" +#include #include #include @@ -31,6 +32,7 @@ using namespace opensaml::saml2md; using namespace opensaml; using namespace xmlsignature; using namespace xmltooling; +using namespace log4cpp; using namespace std; namespace opensaml { @@ -42,16 +44,18 @@ namespace opensaml { }; }; -static const XMLCh GenericMetadataProvider[] = UNICODE_LITERAL_16(M,e,t,a,d,a,t,a,P,r,o,v,i,d,e,r); -static const XMLCh type[] = UNICODE_LITERAL_4(t,y,p,e); +static const XMLCh _MetadataProvider[] = UNICODE_LITERAL_16(M,e,t,a,d,a,t,a,P,r,o,v,i,d,e,r); +static const XMLCh type[] = UNICODE_LITERAL_4(t,y,p,e); ChainingMetadataProvider::ChainingMetadataProvider(const DOMElement* e) : ObservableMetadataProvider(e), m_tlsKey(NULL) { + Category& log=Category::getInstance(SAML_LOGCAT".Metadata"); try { - e = e ? xmltooling::XMLHelper::getFirstChildElement(e, GenericMetadataProvider) : NULL; + e = e ? XMLHelper::getFirstChildElement(e, _MetadataProvider) : NULL; while (e) { auto_ptr_char temp(e->getAttributeNS(NULL,type)); - if (temp.get()) { + if (temp.get() && *temp.get()) { + log.info("building MetadataProvider of type %s", temp.get()); auto_ptr provider( SAMLConfig::getConfig().MetadataProviderManager.newPlugin(temp.get(), e) ); @@ -61,10 +65,10 @@ ChainingMetadataProvider::ChainingMetadataProvider(const DOMElement* e) : Observ m_providers.push_back(provider.get()); provider.release(); } - e = XMLHelper::getNextSiblingElement(e, GenericMetadataProvider); + e = XMLHelper::getNextSiblingElement(e, _MetadataProvider); } } - catch (XMLToolingException&) { + catch (exception&) { for_each(m_providers.begin(), m_providers.end(), xmltooling::cleanup()); throw; }