From: cantor Date: Tue, 31 Jul 2007 17:59:23 +0000 (+0000) Subject: Convert logging to log4shib via compile time switch. X-Git-Tag: 2.4~826 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fsp.git;a=commitdiff_plain;h=7b7c8bd1f79f1ba7650f185970d0864a157b4818 Convert logging to log4shib via compile time switch. git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@2377 cb58f699-b61c-0410-a6fe-9272a202ed29 --- diff --git a/adfs/adfs-lite.vcproj b/adfs/adfs-lite.vcproj index b9afe32..e2e4f18 100644 --- a/adfs/adfs-lite.vcproj +++ b/adfs/adfs-lite.vcproj @@ -62,7 +62,7 @@ /> #include #include +#include #include #include #include -#include #include #ifndef SHIBSP_LITE @@ -67,9 +67,9 @@ using namespace opensaml::saml2md; #endif using namespace shibsp; using namespace opensaml; +using namespace xmltooling::logging; using namespace xmltooling; using namespace xercesc; -using namespace log4cpp; using namespace std; #define WSFED_NS "http://schemas.xmlsoap.org/ws/2003/07/secext" diff --git a/adfs/adfs.vcproj b/adfs/adfs.vcproj index 6c707e5..5119beb 100644 --- a/adfs/adfs.vcproj +++ b/adfs/adfs.vcproj @@ -62,7 +62,7 @@ /> term(); - g_Config = NULL; - } - ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,0,NULL,"shib_exit() done"); - return OK; -} -#endif - // Initial look at a request - create the per-request structure static int shib_post_read(request_rec *r) @@ -1066,29 +1050,35 @@ extern "C" int shib_fixups(request_rec* r) return OK; } +#ifdef SHIB_APACHE_13 /* * shib_child_exit() * Cleanup the (per-process) pool info. */ -#ifdef SHIB_APACHE_13 extern "C" void shib_child_exit(server_rec* s, SH_AP_POOL* p) { -#else -extern "C" apr_status_t shib_child_exit(void* data) -{ - server_rec* s = NULL; -#endif if (g_Config) { ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(s),"shib_child_exit(%d) dealing with g_Config..", (int)getpid()); g_Config->term(); g_Config = NULL; ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(s),"shib_child_exit() done"); } - -#ifndef SHIB_APACHE_13 +} +#else +/* + * shib_exit() + * Apache 2.x doesn't allow for per-child cleanup, causes CGI forks to hang. + */ +extern "C" apr_status_t shib_exit(void* data) +{ + if (g_Config) { + g_Config->term(); + g_Config = NULL; + } + ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,0,NULL,"shib_exit() done"); return OK; -#endif } +#endif /* * shire_child_init() @@ -1155,7 +1145,7 @@ extern "C" void shib_child_init(apr_pool_t* p, server_rec* s) } // Set the cleanup handler - apr_pool_cleanup_register(p, NULL, &shib_exit, &shib_child_exit); + apr_pool_cleanup_register(p, NULL, &shib_exit, apr_pool_cleanup_null); ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(s),"shib_child_init() done"); } diff --git a/apache/mod_shib13.vcproj b/apache/mod_shib13.vcproj index 01f33fc..ef3c30f 100644 --- a/apache/mod_shib13.vcproj +++ b/apache/mod_shib13.vcproj @@ -76,7 +76,7 @@ /> ], + [log4cpp::Category::getInstance("foo")], + [AC_DEFINE(SHIBSP_LOG4CPP,1,[Define if log4cpp library is used.])], + [AC_MSG_ERROR([unable to link with log4cpp])]) fi -AC_CHECK_HEADER([log4cpp/Category.hh],,AC_MSG_ERROR([unable to find log4cpp header files])) +AC_CHECK_HEADER([log4shib/Category.hh],,AC_MSG_ERROR([unable to find log4shib header files])) AC_TRY_LINK( - [#include ], - [log4cpp::Category::getInstance("foo")], - [AC_DEFINE(HAVE_LIBLOG4CPP,1,[Define if log4cpp library was found])], - [AC_MSG_ERROR([unable to link with log4cpp])]) + [#include ], + [log4shib::Category::getInstance("foo")], + [AC_DEFINE(SHIBSP_LOG4SHIB,1,[Define if log4shib library is used.])], + [AC_MSG_ERROR([unable to link with log4shib])]) + # Xerces settings AC_ARG_WITH(xerces, diff --git a/isapi_shib/isapi_shib.vcproj b/isapi_shib/isapi_shib.vcproj index 2af5fab..532cd18 100644 --- a/isapi_shib/isapi_shib.vcproj +++ b/isapi_shib/isapi_shib.vcproj @@ -78,7 +78,7 @@ #include +#include #include #include #include @@ -48,9 +48,9 @@ #include #include +using namespace xmltooling::logging; using namespace xmltooling; using namespace xercesc; -using namespace log4cpp; using namespace std; #define PLUGIN_VER_MAJOR 1 diff --git a/odbc-store/odbc-store.vcproj b/odbc-store/odbc-store.vcproj index cefc0fe..0edfdea 100644 --- a/odbc-store/odbc-store.vcproj +++ b/odbc-store/odbc-store.vcproj @@ -61,7 +61,7 @@ /> #include -#include #include #include #include @@ -53,7 +52,6 @@ #include using namespace shibsp; -using namespace log4cpp; using namespace xmltooling; using namespace std; diff --git a/shibd/shibd.vcproj b/shibd/shibd.vcproj index 8efc825..ac84e1e 100644 --- a/shibd/shibd.vcproj +++ b/shibd/shibd.vcproj @@ -67,7 +67,7 @@ /> - using namespace shibsp; using namespace opensaml; using namespace xmltooling; -using namespace log4cpp; using namespace std; AbstractSPRequest::AbstractSPRequest() @@ -277,10 +274,10 @@ const char* AbstractSPRequest::getHandlerURL(const char* resource) const void AbstractSPRequest::log(SPLogLevel level, const std::string& msg) const { reinterpret_cast(m_log)->log( - (level == SPDebug ? log4cpp::Priority::DEBUG : - (level == SPInfo ? log4cpp::Priority::INFO : - (level == SPWarn ? log4cpp::Priority::WARN : - (level == SPError ? log4cpp::Priority::ERROR : log4cpp::Priority::CRIT)))), + (level == SPDebug ? Priority::DEBUG : + (level == SPInfo ? Priority::INFO : + (level == SPWarn ? Priority::WARN : + (level == SPError ? Priority::ERROR : Priority::CRIT)))), msg ); } @@ -288,9 +285,9 @@ void AbstractSPRequest::log(SPLogLevel level, const std::string& msg) const bool AbstractSPRequest::isPriorityEnabled(SPLogLevel level) const { return reinterpret_cast(m_log)->isPriorityEnabled( - (level == SPDebug ? log4cpp::Priority::DEBUG : - (level == SPInfo ? log4cpp::Priority::INFO : - (level == SPWarn ? log4cpp::Priority::WARN : - (level == SPError ? log4cpp::Priority::ERROR : log4cpp::Priority::CRIT)))) + (level == SPDebug ? Priority::DEBUG : + (level == SPInfo ? Priority::INFO : + (level == SPWarn ? Priority::WARN : + (level == SPError ? Priority::ERROR : Priority::CRIT)))) ); } diff --git a/shibsp/SPConfig.cpp b/shibsp/SPConfig.cpp index 3c9ad7f..26b86fe 100644 --- a/shibsp/SPConfig.cpp +++ b/shibsp/SPConfig.cpp @@ -22,6 +22,19 @@ */ #include "internal.h" + +#if defined(XMLTOOLING_LOG4SHIB) +# ifndef SHIBSP_LOG4SHIB +# error "Logging library mismatch (XMLTooling is using log4shib)." +# endif +#elif defined(XMLTOOLING_LOG4CPP) +# ifndef SHIBSP_LOG4CPP +# error "Logging library mismatch (XMLTooling is using log4cpp)." +# endif +#else +# error "No supported logging library." +#endif + #include "AccessControl.h" #include "exceptions.h" #include "RequestMapper.h" @@ -46,14 +59,12 @@ # include #endif -#include #include #include using namespace shibsp; using namespace opensaml; using namespace xmltooling; -using namespace log4cpp; DECL_XMLTOOLING_EXCEPTION_FACTORY(AttributeException,shibsp); DECL_XMLTOOLING_EXCEPTION_FACTORY(AttributeExtractionException,shibsp); diff --git a/shibsp/TransactionLog.h b/shibsp/TransactionLog.h index 843c921..64ba2bc 100644 --- a/shibsp/TransactionLog.h +++ b/shibsp/TransactionLog.h @@ -24,7 +24,7 @@ #define __shibsp_txlog_h__ #include -#include +#include #include #include @@ -40,7 +40,7 @@ namespace shibsp { MAKE_NONCOPYABLE(TransactionLog); public: TransactionLog() - : log(log4cpp::Category::getInstance(SHIBSP_TX_LOGCAT)), m_lock(xmltooling::Mutex::create()) { + : log(xmltooling::logging::Category::getInstance(SHIBSP_TX_LOGCAT)), m_lock(xmltooling::Mutex::create()) { } virtual ~TransactionLog() { @@ -57,7 +57,7 @@ namespace shibsp { } /** Logging object. */ - log4cpp::Category& log; + xmltooling::logging::Category& log; private: xmltooling::Mutex* m_lock; diff --git a/shibsp/attribute/NameIDAttributeDecoder.cpp b/shibsp/attribute/NameIDAttributeDecoder.cpp index 832a327..19ea010 100644 --- a/shibsp/attribute/NameIDAttributeDecoder.cpp +++ b/shibsp/attribute/NameIDAttributeDecoder.cpp @@ -24,7 +24,6 @@ #include "attribute/AttributeDecoder.h" #include "attribute/NameIDAttribute.h" -#include #include #include @@ -32,7 +31,6 @@ using namespace shibsp; using namespace opensaml::saml1; using namespace opensaml::saml2; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/attribute/ScopedAttributeDecoder.cpp b/shibsp/attribute/ScopedAttributeDecoder.cpp index 48652ce..587d346 100644 --- a/shibsp/attribute/ScopedAttributeDecoder.cpp +++ b/shibsp/attribute/ScopedAttributeDecoder.cpp @@ -24,7 +24,6 @@ #include "attribute/AttributeDecoder.h" #include "attribute/ScopedAttribute.h" -#include #include #include @@ -32,7 +31,6 @@ using namespace shibsp; using namespace opensaml::saml1; using namespace opensaml::saml2; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/attribute/StringAttributeDecoder.cpp b/shibsp/attribute/StringAttributeDecoder.cpp index 4e0bcfb..b652ee0 100644 --- a/shibsp/attribute/StringAttributeDecoder.cpp +++ b/shibsp/attribute/StringAttributeDecoder.cpp @@ -24,7 +24,6 @@ #include "attribute/AttributeDecoder.h" #include "attribute/SimpleAttribute.h" -#include #include #include @@ -32,7 +31,6 @@ using namespace shibsp; using namespace opensaml::saml1; using namespace opensaml::saml2; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/attribute/filtering/impl/ChainingAttributeFilter.cpp b/shibsp/attribute/filtering/impl/ChainingAttributeFilter.cpp index 3069ffd..7842a59 100644 --- a/shibsp/attribute/filtering/impl/ChainingAttributeFilter.cpp +++ b/shibsp/attribute/filtering/impl/ChainingAttributeFilter.cpp @@ -24,13 +24,11 @@ #include "attribute/filtering/AttributeFilter.h" #include "attribute/filtering/FilteringContext.h" -#include #include #include using namespace shibsp; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/attribute/filtering/impl/XMLAttributeFilter.cpp b/shibsp/attribute/filtering/impl/XMLAttributeFilter.cpp index 1dd0a2c..86d56c8 100644 --- a/shibsp/attribute/filtering/impl/XMLAttributeFilter.cpp +++ b/shibsp/attribute/filtering/impl/XMLAttributeFilter.cpp @@ -37,7 +37,6 @@ using namespace shibsp; using namespace opensaml::saml2md; using namespace opensaml; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/attribute/resolver/impl/ChainingAttributeResolver.cpp b/shibsp/attribute/resolver/impl/ChainingAttributeResolver.cpp index 8de4e3d..6579762 100644 --- a/shibsp/attribute/resolver/impl/ChainingAttributeResolver.cpp +++ b/shibsp/attribute/resolver/impl/ChainingAttributeResolver.cpp @@ -27,7 +27,6 @@ #include "attribute/resolver/AttributeResolver.h" #include "attribute/resolver/ResolutionContext.h" -#include #include #include @@ -35,7 +34,6 @@ using namespace shibsp; using namespace opensaml::saml2; using namespace opensaml::saml2md; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/attribute/resolver/impl/QueryAttributeResolver.cpp b/shibsp/attribute/resolver/impl/QueryAttributeResolver.cpp index c5a92f8..f0debc4 100644 --- a/shibsp/attribute/resolver/impl/QueryAttributeResolver.cpp +++ b/shibsp/attribute/resolver/impl/QueryAttributeResolver.cpp @@ -33,7 +33,6 @@ #include "binding/SOAPClient.h" #include "util/SPConstants.h" -#include #include #include #include @@ -57,7 +56,6 @@ using namespace opensaml::saml2p; using namespace opensaml::saml2md; using namespace opensaml; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/attribute/resolver/impl/XMLAttributeExtractor.cpp b/shibsp/attribute/resolver/impl/XMLAttributeExtractor.cpp index b8b145a..44bf5e4 100644 --- a/shibsp/attribute/resolver/impl/XMLAttributeExtractor.cpp +++ b/shibsp/attribute/resolver/impl/XMLAttributeExtractor.cpp @@ -39,7 +39,6 @@ using namespace shibsp; using namespace opensaml::saml2md; using namespace opensaml; using namespace xmltooling; -using namespace log4cpp; using namespace std; using saml1::NameIdentifier; using saml2::NameID; diff --git a/shibsp/binding/impl/ArtifactResolver.cpp b/shibsp/binding/impl/ArtifactResolver.cpp index f457a3f..0f35ef5 100644 --- a/shibsp/binding/impl/ArtifactResolver.cpp +++ b/shibsp/binding/impl/ArtifactResolver.cpp @@ -35,15 +35,12 @@ #include #include -#include - using namespace shibsp; using namespace opensaml::saml1p; using namespace opensaml::saml2; using namespace opensaml::saml2p; using namespace opensaml::saml2md; using namespace opensaml; -using namespace log4cpp; using namespace xmltooling; using namespace std; @@ -56,6 +53,7 @@ saml1p::Response* ArtifactResolver::resolve( MetadataCredentialCriteria mcc(idpDescriptor); shibsp::SOAPClient soaper(dynamic_cast(policy)); + bool foundEndpoint = false; auto_ptr_XMLCh binding(samlconstants::SAML1_BINDING_SOAP); saml1p::Response* response=NULL; const vector& endpoints=idpDescriptor.getArtifactResolutionServices(); @@ -63,6 +61,7 @@ saml1p::Response* ArtifactResolver::resolve( try { if (!XMLString::equals((*ep)->getBinding(),binding.get())) continue; + foundEndpoint = true; auto_ptr_char loc((*ep)->getLocation()); saml1p::Request* request = saml1p::RequestBuilder::buildRequest(); request->setMinorVersion(idpDescriptor.hasSupport(samlconstants::SAML11_PROTOCOL_ENUM) ? 1 : 0); @@ -83,7 +82,9 @@ saml1p::Response* ArtifactResolver::resolve( } } - if (!response) + if (!foundEndpoint) + throw MetadataException("No compatible endpoint found in issuer's metadata."); + else if (!response) throw BindingException("Unable to resolve artifact(s) into a SAML response."); const QName* code = (response->getStatus() && response->getStatus()->getStatusCode()) ? response->getStatus()->getStatusCode()->getValue() : NULL; if (!code || *code != saml1p::StatusCode::SUCCESS) { @@ -104,6 +105,7 @@ ArtifactResponse* ArtifactResolver::resolve( shibsp::SecurityPolicy& sppolicy = dynamic_cast(policy); shibsp::SOAPClient soaper(sppolicy); + bool foundEndpoint = false; auto_ptr_XMLCh binding(samlconstants::SAML20_BINDING_SOAP); ArtifactResponse* response=NULL; const vector& endpoints=ssoDescriptor.getArtifactResolutionServices(); @@ -111,6 +113,7 @@ ArtifactResponse* ArtifactResolver::resolve( try { if (!XMLString::equals((*ep)->getBinding(),binding.get())) continue; + foundEndpoint = true; auto_ptr_char loc((*ep)->getLocation()); auto_ptr_XMLCh issuer(sppolicy.getApplication().getString("entityID").second); ArtifactResolve* request = ArtifactResolveBuilder::buildArtifactResolve(); @@ -136,9 +139,11 @@ ArtifactResponse* ArtifactResolver::resolve( } } - if (!response) + if (!foundEndpoint) + throw MetadataException("No compatible endpoint found in issuer's metadata."); + else if (!response) throw BindingException("Unable to resolve artifact(s) into a SAML response."); - if (!response->getStatus() || !response->getStatus()->getStatusCode() || + else if (!response->getStatus() || !response->getStatus()->getStatusCode() || !XMLString::equals(response->getStatus()->getStatusCode()->getValue(), saml2p::StatusCode::SUCCESS)) { delete response; throw BindingException("Identity provider returned a SAML error in response to artifact."); diff --git a/shibsp/binding/impl/SOAPClient.cpp b/shibsp/binding/impl/SOAPClient.cpp index 8dc0574..29a002a 100644 --- a/shibsp/binding/impl/SOAPClient.cpp +++ b/shibsp/binding/impl/SOAPClient.cpp @@ -26,7 +26,6 @@ #include "ServiceProvider.h" #include "binding/SOAPClient.h" -#include #include #include #include @@ -36,7 +35,6 @@ using namespace shibsp; using namespace opensaml::saml2md; using namespace xmlsignature; using namespace xmltooling; -using namespace log4cpp; using namespace std; SOAPClient::SOAPClient(SecurityPolicy& policy) diff --git a/shibsp/handler/AbstractHandler.h b/shibsp/handler/AbstractHandler.h index 6d2e0b8..7893b13 100644 --- a/shibsp/handler/AbstractHandler.h +++ b/shibsp/handler/AbstractHandler.h @@ -26,11 +26,11 @@ #include #include -#include #ifndef SHIBSP_LITE # include # include #endif +#include #include #include #include @@ -60,7 +60,7 @@ namespace shibsp { */ AbstractHandler( const xercesc::DOMElement* e, - log4cpp::Category& log, + xmltooling::logging::Category& log, xercesc::DOMNodeFilter* filter=NULL, const std::map* remapper=NULL ); @@ -149,7 +149,7 @@ namespace shibsp { ) const; /** Logging object. */ - log4cpp::Category& m_log; + xmltooling::logging::Category& m_log; /** Configuration namespace for custom properties. */ xmltooling::auto_ptr_char m_configNS; diff --git a/shibsp/handler/AssertionConsumerService.h b/shibsp/handler/AssertionConsumerService.h index df28122..bbedd6c 100644 --- a/shibsp/handler/AssertionConsumerService.h +++ b/shibsp/handler/AssertionConsumerService.h @@ -60,7 +60,7 @@ namespace shibsp { * @param appId ID of application that "owns" the handler * @param log a logging object to use */ - AssertionConsumerService(const xercesc::DOMElement* e, const char* appId, log4cpp::Category& log); + AssertionConsumerService(const xercesc::DOMElement* e, const char* appId, xmltooling::logging::Category& log); #ifndef SHIBSP_LITE /** diff --git a/shibsp/handler/impl/AbstractHandler.cpp b/shibsp/handler/impl/AbstractHandler.cpp index 19eb60c..22910f9 100644 --- a/shibsp/handler/impl/AbstractHandler.cpp +++ b/shibsp/handler/impl/AbstractHandler.cpp @@ -51,7 +51,6 @@ using namespace shibsp; using namespace samlconstants; using namespace opensaml; using namespace xmltooling; -using namespace log4cpp; using namespace xercesc; using namespace std; @@ -91,7 +90,7 @@ void SHIBSP_API shibsp::registerHandlers() } AbstractHandler::AbstractHandler( - const DOMElement* e, log4cpp::Category& log, DOMNodeFilter* filter, const map* remapper + const DOMElement* e, Category& log, DOMNodeFilter* filter, const map* remapper ) : m_log(log), m_configNS(shibspconstants::SHIB2SPCONFIG_NS) { load(e,log,filter,remapper); } diff --git a/shibsp/handler/impl/AssertionConsumerService.cpp b/shibsp/handler/impl/AssertionConsumerService.cpp index 57e127c..c8037b7 100644 --- a/shibsp/handler/impl/AssertionConsumerService.cpp +++ b/shibsp/handler/impl/AssertionConsumerService.cpp @@ -44,7 +44,6 @@ using namespace shibspconstants; using namespace shibsp; using namespace opensaml; using namespace xmltooling; -using namespace log4cpp; using namespace std; AssertionConsumerService::AssertionConsumerService(const DOMElement* e, const char* appId, Category& log) diff --git a/shibsp/handler/impl/AssertionLookup.cpp b/shibsp/handler/impl/AssertionLookup.cpp index b9e9415..61cf3b0 100644 --- a/shibsp/handler/impl/AssertionLookup.cpp +++ b/shibsp/handler/impl/AssertionLookup.cpp @@ -33,7 +33,6 @@ using namespace shibspconstants; using namespace shibsp; using namespace opensaml; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/handler/impl/ChainingLogoutInitiator.cpp b/shibsp/handler/impl/ChainingLogoutInitiator.cpp index 6ca0e7f..c81fdfa 100644 --- a/shibsp/handler/impl/ChainingLogoutInitiator.cpp +++ b/shibsp/handler/impl/ChainingLogoutInitiator.cpp @@ -31,7 +31,6 @@ using namespace shibsp; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/handler/impl/ChainingSessionInitiator.cpp b/shibsp/handler/impl/ChainingSessionInitiator.cpp index 38bad77..803e776 100644 --- a/shibsp/handler/impl/ChainingSessionInitiator.cpp +++ b/shibsp/handler/impl/ChainingSessionInitiator.cpp @@ -31,7 +31,6 @@ using namespace shibsp; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/handler/impl/LocalLogoutInitiator.cpp b/shibsp/handler/impl/LocalLogoutInitiator.cpp index 90c8397..e048f0b 100644 --- a/shibsp/handler/impl/LocalLogoutInitiator.cpp +++ b/shibsp/handler/impl/LocalLogoutInitiator.cpp @@ -29,7 +29,6 @@ using namespace shibsp; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/handler/impl/LogoutHandler.cpp b/shibsp/handler/impl/LogoutHandler.cpp index 901e45b..39c3e92 100644 --- a/shibsp/handler/impl/LogoutHandler.cpp +++ b/shibsp/handler/impl/LogoutHandler.cpp @@ -29,7 +29,6 @@ #include "util/TemplateParameters.h" #include -#include #include #include @@ -91,7 +90,7 @@ void LogoutHandler::receive(DDF& in, ostream& out) const Application* app=aid ? SPConfig::getConfig().getServiceProvider()->getApplication(aid) : NULL; if (!app) { // Something's horribly wrong. - log4cpp::Category::getInstance(SHIBSP_LOGCAT".Logout").error("couldn't find application (%s) for logout", aid ? aid : "(missing)"); + Category::getInstance(SHIBSP_LOGCAT".Logout").error("couldn't find application (%s) for logout", aid ? aid : "(missing)"); throw ConfigurationException("Unable to locate application for logout, deleted?"); } @@ -216,7 +215,7 @@ bool LogoutHandler::notifyBackChannel( delete soaper.receive(); } catch (exception& ex) { - log4cpp::Category::getInstance(SHIBSP_LOGCAT".Logout").error("error notifying application of logout event: %s", ex.what()); + Category::getInstance(SHIBSP_LOGCAT".Logout").error("error notifying application of logout event: %s", ex.what()); result = false; } soaper.reset(); diff --git a/shibsp/handler/impl/RemotedHandler.cpp b/shibsp/handler/impl/RemotedHandler.cpp index 2838d14..e2c18ff 100644 --- a/shibsp/handler/impl/RemotedHandler.cpp +++ b/shibsp/handler/impl/RemotedHandler.cpp @@ -27,7 +27,6 @@ #include "handler/RemotedHandler.h" #include -#include #include #ifndef SHIBSP_LITE @@ -41,7 +40,6 @@ using namespace shibsp; using namespace opensaml; using namespace xmltooling; -using namespace log4cpp; using namespace xercesc; using namespace std; diff --git a/shibsp/handler/impl/SAML1Consumer.cpp b/shibsp/handler/impl/SAML1Consumer.cpp index 871fe80..8b44d5c 100644 --- a/shibsp/handler/impl/SAML1Consumer.cpp +++ b/shibsp/handler/impl/SAML1Consumer.cpp @@ -49,7 +49,6 @@ using saml2md::EntityDescriptor; using namespace shibsp; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/handler/impl/SAML2ArtifactResolution.cpp b/shibsp/handler/impl/SAML2ArtifactResolution.cpp index fdf31ed..6a1097b 100644 --- a/shibsp/handler/impl/SAML2ArtifactResolution.cpp +++ b/shibsp/handler/impl/SAML2ArtifactResolution.cpp @@ -51,7 +51,6 @@ using namespace shibsp; using namespace opensaml; using namespace soap11; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/handler/impl/SAML2Consumer.cpp b/shibsp/handler/impl/SAML2Consumer.cpp index bbc9f49..2bae0f5 100644 --- a/shibsp/handler/impl/SAML2Consumer.cpp +++ b/shibsp/handler/impl/SAML2Consumer.cpp @@ -48,7 +48,6 @@ using namespace opensaml; using namespace shibsp; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/handler/impl/SAML2Logout.cpp b/shibsp/handler/impl/SAML2Logout.cpp index 4684c83..0240946 100644 --- a/shibsp/handler/impl/SAML2Logout.cpp +++ b/shibsp/handler/impl/SAML2Logout.cpp @@ -46,7 +46,6 @@ using namespace opensaml; using namespace shibsp; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/handler/impl/SAML2LogoutInitiator.cpp b/shibsp/handler/impl/SAML2LogoutInitiator.cpp index df0cb46..527ae3d 100644 --- a/shibsp/handler/impl/SAML2LogoutInitiator.cpp +++ b/shibsp/handler/impl/SAML2LogoutInitiator.cpp @@ -45,7 +45,6 @@ using namespace opensaml; using namespace shibsp; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/handler/impl/SAML2SessionInitiator.cpp b/shibsp/handler/impl/SAML2SessionInitiator.cpp index 8908af3..0992d4d 100644 --- a/shibsp/handler/impl/SAML2SessionInitiator.cpp +++ b/shibsp/handler/impl/SAML2SessionInitiator.cpp @@ -44,7 +44,6 @@ using namespace opensaml::saml2md; using namespace shibsp; using namespace opensaml; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/handler/impl/SAMLDSSessionInitiator.cpp b/shibsp/handler/impl/SAMLDSSessionInitiator.cpp index d71b7c1..42614f1 100644 --- a/shibsp/handler/impl/SAMLDSSessionInitiator.cpp +++ b/shibsp/handler/impl/SAMLDSSessionInitiator.cpp @@ -33,7 +33,6 @@ using namespace shibsp; using namespace opensaml; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/handler/impl/Shib1SessionInitiator.cpp b/shibsp/handler/impl/Shib1SessionInitiator.cpp index e1fbc90..e7564e9 100644 --- a/shibsp/handler/impl/Shib1SessionInitiator.cpp +++ b/shibsp/handler/impl/Shib1SessionInitiator.cpp @@ -41,7 +41,6 @@ using namespace shibsp; using namespace opensaml::saml2md; using namespace opensaml; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/handler/impl/WAYFSessionInitiator.cpp b/shibsp/handler/impl/WAYFSessionInitiator.cpp index 0d5e541..03f0ea2 100644 --- a/shibsp/handler/impl/WAYFSessionInitiator.cpp +++ b/shibsp/handler/impl/WAYFSessionInitiator.cpp @@ -34,7 +34,6 @@ using namespace shibsp; using namespace opensaml; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/impl/RemotedSessionCache.cpp b/shibsp/impl/RemotedSessionCache.cpp index 180bbc3..04364e0 100644 --- a/shibsp/impl/RemotedSessionCache.cpp +++ b/shibsp/impl/RemotedSessionCache.cpp @@ -31,7 +31,6 @@ #include #include -#include #include #include #include @@ -39,7 +38,6 @@ using namespace shibsp; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/impl/StorageServiceSessionCache.cpp b/shibsp/impl/StorageServiceSessionCache.cpp index c41f599..38d5989 100644 --- a/shibsp/impl/StorageServiceSessionCache.cpp +++ b/shibsp/impl/StorageServiceSessionCache.cpp @@ -38,7 +38,6 @@ #include "remoting/ListenerService.h" #include "util/SPConstants.h" -#include #include #include #include @@ -49,7 +48,6 @@ using namespace shibsp; using namespace opensaml::saml2md; using namespace opensaml; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/impl/XMLAccessControl.cpp b/shibsp/impl/XMLAccessControl.cpp index f134dee..7f51df8 100644 --- a/shibsp/impl/XMLAccessControl.cpp +++ b/shibsp/impl/XMLAccessControl.cpp @@ -82,7 +82,7 @@ namespace { { public: XMLAccessControl(const DOMElement* e) - : ReloadableXMLFile(e, log4cpp::Category::getInstance(SHIBSP_LOGCAT".AccessControl")), m_rootAuthz(NULL) { + : ReloadableXMLFile(e, Category::getInstance(SHIBSP_LOGCAT".AccessControl")), m_rootAuthz(NULL) { load(); // guarantees an exception or the policy is loaded } diff --git a/shibsp/impl/XMLRequestMapper.cpp b/shibsp/impl/XMLRequestMapper.cpp index 2af0e2c..9119623 100644 --- a/shibsp/impl/XMLRequestMapper.cpp +++ b/shibsp/impl/XMLRequestMapper.cpp @@ -35,7 +35,6 @@ using namespace shibsp; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace shibsp { diff --git a/shibsp/impl/XMLServiceProvider.cpp b/shibsp/impl/XMLServiceProvider.cpp index 9e965b3..dce4b54 100644 --- a/shibsp/impl/XMLServiceProvider.cpp +++ b/shibsp/impl/XMLServiceProvider.cpp @@ -34,8 +34,13 @@ #include "util/DOMPropertySet.h" #include "util/SPConstants.h" -#include -#include +#if defined(XMLTOOLING_LOG4SHIB) +# include +#elif defined(XMLTOOLING_LOG4CPP) +# include +#else +# error "Supported logging library not available." +#endif #include #include #include @@ -64,7 +69,6 @@ using namespace opensaml; using namespace shibsp; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace { diff --git a/shibsp/internal.h b/shibsp/internal.h index b609431..e10017b 100644 --- a/shibsp/internal.h +++ b/shibsp/internal.h @@ -43,6 +43,9 @@ #include "base.h" #include "SPConfig.h" +#include + +using namespace xmltooling::logging; using namespace xercesc; namespace shibsp { diff --git a/shibsp/remoting/impl/ListenerService.cpp b/shibsp/remoting/impl/ListenerService.cpp index 2c40905..20ab9b5 100644 --- a/shibsp/remoting/impl/ListenerService.cpp +++ b/shibsp/remoting/impl/ListenerService.cpp @@ -25,12 +25,10 @@ #include "ServiceProvider.h" #include "remoting/ListenerService.h" -#include #include using namespace shibsp; using namespace xmltooling; -using namespace log4cpp; using namespace xercesc; using namespace std; diff --git a/shibsp/remoting/impl/SocketListener.cpp b/shibsp/remoting/impl/SocketListener.cpp index c67958e..66ebeb8 100644 --- a/shibsp/remoting/impl/SocketListener.cpp +++ b/shibsp/remoting/impl/SocketListener.cpp @@ -36,7 +36,6 @@ using namespace shibsp; using namespace xmltooling; -using namespace log4cpp; using namespace std; using xercesc::DOMElement; diff --git a/shibsp/remoting/impl/SocketListener.h b/shibsp/remoting/impl/SocketListener.h index 1c9d612..4544e36 100644 --- a/shibsp/remoting/impl/SocketListener.h +++ b/shibsp/remoting/impl/SocketListener.h @@ -29,8 +29,8 @@ #include -#include #include +#include #include #ifdef WIN32 @@ -71,7 +71,7 @@ namespace shibsp { protected: bool log_error() const; // for OS-level errors - log4cpp::Category* log; + xmltooling::logging::Category* log; /// @endcond private: diff --git a/shibsp/shibsp-lite.vcproj b/shibsp/shibsp-lite.vcproj index 1d7a6ac..9ec04bb 100644 --- a/shibsp/shibsp-lite.vcproj +++ b/shibsp/shibsp-lite.vcproj @@ -61,7 +61,7 @@ /> -#include +#include namespace shibsp { @@ -67,7 +67,7 @@ namespace shibsp { */ void load( const xercesc::DOMElement* e, - log4cpp::Category& log, + xmltooling::logging::Category& log, xercesc::DOMNodeFilter* filter, const std::map* remapper=NULL ); diff --git a/util/samlquery.vcproj b/util/samlquery.vcproj index a6085fb..48ba614 100644 --- a/util/samlquery.vcproj +++ b/util/samlquery.vcproj @@ -67,7 +67,7 @@ /> #include #include +#include #include #include #include #include -#include -#include +#if defined(XMLTOOLING_LOG4SHIB) +# include +#elif defined(XMLTOOLING_LOG4CPP) +# include +#endif #include #include #include @@ -48,12 +52,12 @@ using namespace xmlsignature; using namespace xmlconstants; +using namespace xmltooling::logging; using namespace xmltooling; using namespace samlconstants; using namespace opensaml::saml2md; using namespace opensaml; using namespace xercesc; -using namespace log4cpp; using namespace std; void verifySignature(DOMDocument* doc, DOMNode* sigNode, const char* cert=NULL) diff --git a/util/siterefresh.vcproj b/util/siterefresh.vcproj index 773bd95..e17628f 100644 --- a/util/siterefresh.vcproj +++ b/util/siterefresh.vcproj @@ -72,7 +72,7 @@ />