Convert logging to log4shib via compile time switch.
[shibboleth/sp.git] / shibsp / impl / XMLServiceProvider.cpp
index 958df0e..dce4b54 100644 (file)
 #include "util/DOMPropertySet.h"
 #include "util/SPConstants.h"
 
-#include <log4cpp/Category.hh>
-#include <log4cpp/PropertyConfigurator.hh>
+#if defined(XMLTOOLING_LOG4SHIB)
+# include <log4shib/PropertyConfigurator.hh>
+#elif defined(XMLTOOLING_LOG4CPP)
+# include <log4cpp/PropertyConfigurator.hh>
+#else
+# error "Supported logging library not available."
+#endif
 #include <xercesc/util/XMLUniDefs.hpp>
 #include <xmltooling/XMLToolingConfig.h>
 #include <xmltooling/util/NDC.h>
@@ -64,7 +69,6 @@ using namespace opensaml;
 
 using namespace shibsp;
 using namespace xmltooling;
-using namespace log4cpp;
 using namespace std;
 
 namespace {
@@ -526,7 +530,10 @@ XMLApplication::XMLApplication(
                 handler = conf.HandlerManager.newPlugin(samlconstants::SAML20_BINDING_URI, make_pair(sessions->getElement(), getId()));
                 m_handlers.push_back(handler);
 
-                // Insert into location map.
+                // Insert into location map. If it contains the handlerURL, we skip past that part.
+                const char* pch = strstr(location.second, sessions->getString("handlerURL").second);
+                if (pch)
+                    location.second = pch + strlen(sessions->getString("handlerURL").second);
                 if (*location.second == '/')
                     m_handlerMap[location.second]=handler;
                 else