[cpp-sp] 02/02: Clean up logging API and migrate handlers over to request logger.

Scott Cantor cantor.2 at osu.edu
Tue Jun 24 18:58:41 UTC 2025


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository cpp-sp.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=384741beaefc073f0bcc81a2ab29d93f81ebff38

commit 384741beaefc073f0bcc81a2ab29d93f81ebff38
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Jun 24 14:58:36 2025 -0400

    Clean up logging API and migrate handlers over to request logger.
---
 apache/mod_shib_24.cpp                          | 26 ++++++++++++-------------
 shibsp/AbstractSPRequest.cpp                    | 25 ++++++++++++++++++++++++
 shibsp/Agent.cpp                                |  4 ++--
 shibsp/SPRequest.h                              |  6 ++++++
 shibsp/handler/AbstractHandler.h                |  7 +------
 shibsp/handler/SecuredHandler.h                 |  2 --
 shibsp/handler/impl/AbstractHandler.cpp         |  2 +-
 shibsp/handler/impl/AdminLogoutInitiator.cpp    |  7 +++----
 shibsp/handler/impl/AttributeCheckerHandler.cpp |  9 ++++-----
 shibsp/handler/impl/LocalLogoutInitiator.cpp    |  5 ++---
 shibsp/handler/impl/MetadataGenerator.cpp       |  7 +++----
 shibsp/handler/impl/SecuredHandler.cpp          | 10 +++++-----
 shibsp/handler/impl/SessionHandler.cpp          |  5 ++---
 shibsp/handler/impl/SessionInitiator.cpp        |  7 +++----
 shibsp/handler/impl/StatusHandler.cpp           |  8 +++-----
 shibsp/handler/impl/TokenConsumer.cpp           |  9 +++------
 16 files changed, 76 insertions(+), 63 deletions(-)

diff --git a/apache/mod_shib_24.cpp b/apache/mod_shib_24.cpp
index 3e965862..0ec33634 100644
--- a/apache/mod_shib_24.cpp
+++ b/apache/mod_shib_24.cpp
@@ -357,7 +357,7 @@ public:
                 m_firsttime = false;
         }
         if (!m_firsttime)
-            log(Priority::SHIB_DEBUG, "shib_check_user running more than once");
+            debug("shib_check_user running more than once");
     }
     return true;
   }
@@ -428,7 +428,7 @@ public:
         apr_bucket *bucket;
         apr_status_t rv = ap_get_brigade(m_req->input_filters, bb, AP_MODE_READBYTES, APR_BLOCK_READ, HUGE_STRING_LEN);
         if (rv != APR_SUCCESS) {
-            log(Priority::SHIB_ERROR, "Apache function (ap_get_brigade) failed while reading request body.");
+            error("Apache function (ap_get_brigade) failed while reading request body.");
             break;
         }
 
@@ -858,7 +858,7 @@ AccessControl::aclresult_t htAccessControl::doAccessControl(const ShibTargetApac
         result = aclplugin->authorized(sta, session);
     }
     catch (const xml_parser_error& e) {
-        sta.log(Priority::SHIB_ERROR, e.what());
+        sta.error(e.what());
     }
     return result;
 }
@@ -954,7 +954,7 @@ AccessControl::aclresult_t htAccessControl::doAuthnContext(const ShibTargetApach
     }
 
     if (sta.isPriorityEnabled(Priority::SHIB_DEBUG))
-        sta.log(Priority::SHIB_DEBUG, "htaccess: require authnContext rejecting session with no context associated");
+        sta.debug("htaccess: require authnContext rejecting session with no context associated");
     return shib_acl_false;
 }
 
@@ -977,7 +977,7 @@ bool htAccessControl::checkAttribute(
             regexp::regex exp(toMatch, flags);
             if (attrConfig.hasMatchingValue(session, attributeID, exp)) {
                 if (request.isPriorityEnabled(Priority::SHIB_DEBUG)) {
-                    request.log(Priority::SHIB_DEBUG, string("htaccess: attribute (") + attributeID + ") matched regexp: " + toMatch);
+                    request.debug(string("htaccess: attribute (") + attributeID + ") matched regexp: " + toMatch);
                 }
                 return true;
             }
@@ -988,12 +988,12 @@ bool htAccessControl::checkAttribute(
     }
     else if (attrConfig.hasMatchingValue(session, attributeID, toMatch)) {
         if (request.isPriorityEnabled(Priority::SHIB_DEBUG)) {
-            request.log(Priority::SHIB_DEBUG, string("htaccess: attribute (") + attributeID + ") matched " + toMatch);
+            request.debug(string("htaccess: attribute (") + attributeID + ") matched " + toMatch);
         }
         return true;
     }
     else if (request.isPriorityEnabled(Priority::SHIB_DEBUG)) {
-        request.log(Priority::SHIB_DEBUG, string("htaccess: attribute (") + attributeID + ") did not match " + toMatch);
+        request.debug(string("htaccess: attribute (") + attributeID + ") did not match " + toMatch);
     }
     return false;
 }
@@ -1204,15 +1204,15 @@ extern "C" authz_status shib_session_check_authz(request_rec* r, const char*, co
     try {
         unique_lock<Session> session = sta.first->getSession(false, true);
         if (session) {
-            sta.first->log(Priority::SHIB_DEBUG, "htaccess: accepting shib-session/valid-user based on active session");
+            sta.first->debug("htaccess: accepting shib-session/valid-user based on active session");
             return AUTHZ_GRANTED;
         }
     }
     catch (std::exception& e) {
-        sta.first->log(Priority::SHIB_WARN, string("htaccess: unable to obtain session for access control check: ") +  e.what());
+        sta.first->warn(string("htaccess: unable to obtain session for access control check: ") +  e.what());
     }
 
-    sta.first->log(Priority::SHIB_DEBUG, "htaccess: denying shib-access/valid-user rule, no active session");
+    sta.first->debug("htaccess: denying shib-access/valid-user rule, no active session");
     return AUTHZ_DENIED_NO_USER;
 }
 
@@ -1306,7 +1306,7 @@ extern "C" authz_status shib_acclass_check_authz(request_rec* r, const char* req
         return session ? AUTHZ_DENIED : AUTHZ_DENIED_NO_USER;
     }
     catch (std::exception& e) {
-        sta.first->log(Priority::SHIB_WARN, string("htaccess: unable to obtain session for access control check: ") +  e.what());
+        sta.first->warn(string("htaccess: unable to obtain session for access control check: ") +  e.what());
     }
 
     return AUTHZ_GENERAL_ERROR;
@@ -1330,7 +1330,7 @@ extern "C" authz_status shib_attr_check_authz(request_rec* r, const char* requir
         return session ? AUTHZ_DENIED : AUTHZ_DENIED_NO_USER;
     }
     catch (std::exception& e) {
-        sta.first->log(Priority::SHIB_WARN, string("htaccess: unable to obtain session for access control check: ") +  e.what());
+        sta.first->warn(string("htaccess: unable to obtain session for access control check: ") +  e.what());
     }
 
     return AUTHZ_GENERAL_ERROR;
@@ -1354,7 +1354,7 @@ extern "C" authz_status shib_plugin_check_authz(request_rec* r, const char* requ
         return session ? AUTHZ_DENIED : AUTHZ_DENIED_NO_USER;
     }
     catch (std::exception& e) {
-        sta.first->log(Priority::SHIB_WARN, string("htaccess: unable to obtain session for access control check: ") +  e.what());
+        sta.first->warn(string("htaccess: unable to obtain session for access control check: ") +  e.what());
     }
 
     return AUTHZ_GENERAL_ERROR;
diff --git a/shibsp/AbstractSPRequest.cpp b/shibsp/AbstractSPRequest.cpp
index a324cbc9..01bd02ce 100644
--- a/shibsp/AbstractSPRequest.cpp
+++ b/shibsp/AbstractSPRequest.cpp
@@ -436,6 +436,31 @@ bool AbstractSPRequest::isPriorityEnabled(Priority::Value level) const
     return m_log.isPriorityEnabled(level);
 }
 
+void SPRequest::debug(const string& msg) const
+{
+    log(Priority::SHIB_DEBUG, msg);
+}
+
+void SPRequest::info(const string& msg) const
+{
+    log(Priority::SHIB_INFO, msg);
+}
+
+void SPRequest::warn(const string& msg) const
+{
+    log(Priority::SHIB_WARN, msg);
+}
+
+void SPRequest::error(const string& msg) const
+{
+    log(Priority::SHIB_ERROR, msg);
+}
+
+void SPRequest::crit(const string& msg) const
+{
+    log(Priority::SHIB_CRIT, msg);
+}
+
 string AbstractSPRequest::getCGINameForHeader(const char* name) const
 {
     string cgiversion("HTTP_");
diff --git a/shibsp/Agent.cpp b/shibsp/Agent.cpp
index 6a4f0343..edd56a6e 100644
--- a/shibsp/Agent.cpp
+++ b/shibsp/Agent.cpp
@@ -85,7 +85,7 @@ long Agent::handleError(Category& log, SPRequest& request, const Session* sessio
             richEx->log(request);
         }
         else {
-            request.log(Priority::SHIB_ERROR, ex->what());
+            request.error(ex->what());
         }
     }
 
@@ -97,7 +97,7 @@ long Agent::handleError(Category& log, SPRequest& request, const Session* sessio
             redirectErrors = settings.first->getString("redirectErrors");
     }
     catch (const exception& nested) {
-        request.log(Priority::SHIB_ERROR, nested.what());
+        request.error(nested.what());
     }
 
     // Check for redirection on errors.
diff --git a/shibsp/SPRequest.h b/shibsp/SPRequest.h
index fa9303e2..1065b010 100644
--- a/shibsp/SPRequest.h
+++ b/shibsp/SPRequest.h
@@ -172,6 +172,12 @@ namespace shibsp {
          */
         virtual void log(Priority::Value level, const std::string& msg) const=0;
 
+        void debug(const std::string& msg) const;
+        void info(const std::string& msg) const;
+        void warn(const std::string& msg) const;
+        void error(const std::string& msg) const;
+        void crit(const std::string& msg) const;
+
         /**
          * Test logging level.
          *
diff --git a/shibsp/handler/AbstractHandler.h b/shibsp/handler/AbstractHandler.h
index 7c04ffa3..1e410ab6 100644
--- a/shibsp/handler/AbstractHandler.h
+++ b/shibsp/handler/AbstractHandler.h
@@ -31,7 +31,6 @@
 
 namespace shibsp {
 
-    class SHIBSP_API Category;
     class SHIBSP_API SPRequest;
 
 #if defined (_MSC_VER)
@@ -51,9 +50,8 @@ namespace shibsp {
          * Constructor.
          * 
          * @param pt    root of handler configuration
-         * @param log   logging category to use
          */
-        AbstractHandler(const boost::property_tree::ptree& pt, Category& log);
+        AbstractHandler(const boost::property_tree::ptree& pt);
 
         /**
          * Wrap a request for remoting to hub.
@@ -145,9 +143,6 @@ namespace shibsp {
             const char* name, const SPRequest& request, int defaultValue, unsigned int type=HANDLER_PROPERTY_ALL
             ) const;
 
-        /** Logging object. */
-        Category& m_log;
-
     public:
         virtual ~AbstractHandler();
 
diff --git a/shibsp/handler/SecuredHandler.h b/shibsp/handler/SecuredHandler.h
index 22c765ee..17a4c53a 100644
--- a/shibsp/handler/SecuredHandler.h
+++ b/shibsp/handler/SecuredHandler.h
@@ -43,13 +43,11 @@ namespace shibsp {
          * Constructor
          * 
          * @param e             DOM element to load as property set
-         * @param log           logging category to use
          * @param aclProperty   name of IP/CIDR ACL property
          * @param defaultACL    IP/CIDR ACL to apply if no acl property is set
          */
         SecuredHandler(
             const boost::property_tree::ptree& pt,
-            Category& log,
             const char* aclProperty="acl",
             const char* defaultACL=nullptr
             );
diff --git a/shibsp/handler/impl/AbstractHandler.cpp b/shibsp/handler/impl/AbstractHandler.cpp
index 52155b76..9c341206 100644
--- a/shibsp/handler/impl/AbstractHandler.cpp
+++ b/shibsp/handler/impl/AbstractHandler.cpp
@@ -106,7 +106,7 @@ Handler::~Handler()
 {
 }
 
-AbstractHandler::AbstractHandler(const ptree& pt, Category& log) : m_log(log) {
+AbstractHandler::AbstractHandler(const ptree& pt) {
     load(pt);
 }
 
diff --git a/shibsp/handler/impl/AdminLogoutInitiator.cpp b/shibsp/handler/impl/AdminLogoutInitiator.cpp
index 9b9b1d03..feea7053 100644
--- a/shibsp/handler/impl/AdminLogoutInitiator.cpp
+++ b/shibsp/handler/impl/AdminLogoutInitiator.cpp
@@ -62,8 +62,7 @@ namespace shibsp {
     }
 };
 
-AdminLogoutInitiator::AdminLogoutInitiator(const ptree& pt)
-    : SecuredHandler(pt, Category::getInstance(SHIBSP_LOGCAT ".LogoutInitiator.Admin"))
+AdminLogoutInitiator::AdminLogoutInitiator(const ptree& pt) : SecuredHandler(pt)
 {
 }
 
@@ -79,7 +78,7 @@ pair<bool,long> AdminLogoutInitiator::run(SPRequest& request, bool isHandler) co
     const char* sessionId = request.getParameter("session");
     if (!sessionId || !*sessionId) {
         // Something's horribly wrong.
-        m_log.error("no session parameter supplied for request");
+        request.error("no session parameter supplied for request");
         istringstream msg("NO SESSION PARAMETER");
         return make_pair(true, request.sendResponse(msg, HTTPResponse::SHIBSP_HTTP_STATUS_BADREQUEST));
     }
@@ -91,7 +90,7 @@ pair<bool,long> AdminLogoutInitiator::run(SPRequest& request, bool isHandler) co
         session = AgentConfig::getConfig().getAgent().getSessionCache()->find(applicationId, sessionId);
     }
     catch (const std::exception& ex) {
-        m_log.error("error accessing designated session: %s", ex.what());
+        request.error(string("error accessing designated session: ") + ex.what());
     }
 
     // With no session, we return a 404 after "revoking" the session just to be safe.
diff --git a/shibsp/handler/impl/AttributeCheckerHandler.cpp b/shibsp/handler/impl/AttributeCheckerHandler.cpp
index 41177d62..6750cb63 100644
--- a/shibsp/handler/impl/AttributeCheckerHandler.cpp
+++ b/shibsp/handler/impl/AttributeCheckerHandler.cpp
@@ -76,8 +76,7 @@ namespace shibsp {
     }
 };
 
-AttributeCheckerHandler::AttributeCheckerHandler(ptree& pt)
-    : AbstractHandler(pt, Category::getInstance(SHIBSP_LOGCAT ".Handler.AttributeChecker"))
+AttributeCheckerHandler::AttributeCheckerHandler(ptree& pt) : AbstractHandler(pt)
 {
     m_redirectOnFailure = getString("redirectOnFailure", "");
     if (m_redirectOnFailure.empty())
@@ -92,7 +91,7 @@ AttributeCheckerHandler::AttributeCheckerHandler(ptree& pt)
             throw ConfigurationException("AttributeChecker unable to parse attributes setting.");
     }
     else if (hasProperty("path")) {
-        m_log.debug("attempting installation of external AccessControl rule");
+        Category::getInstance(SHIBSP_LOGCAT ".Handler.AttributeChecker").debug("attempting installation of external AccessControl rule");
         m_acl.reset(AgentConfig::getConfig().AccessControlManager.newPlugin(XML_ACCESS_CONTROL, pt, false));
     }
     else {
@@ -119,10 +118,10 @@ pair<bool,long> AttributeCheckerHandler::run(SPRequest& request, bool isHandler)
     try {
         session = request.getSession();
         if (!session)
-            request.log(Priority::SHIB_WARN, "AttributeChecker found session unavailable immediately after creation");
+            request.warn("AttributeChecker found session unavailable immediately after creation");
     }
     catch (const std::exception& ex) {
-        request.log(Priority::SHIB_WARN, string("AttributeChecker caught exception accessing session immediately after creation: ") + ex.what());
+        request.warn(string("AttributeChecker caught exception accessing session immediately after creation: ") + ex.what());
     }
 
     bool checked = false;
diff --git a/shibsp/handler/impl/LocalLogoutInitiator.cpp b/shibsp/handler/impl/LocalLogoutInitiator.cpp
index 16e5b488..4594aeed 100644
--- a/shibsp/handler/impl/LocalLogoutInitiator.cpp
+++ b/shibsp/handler/impl/LocalLogoutInitiator.cpp
@@ -59,8 +59,7 @@ namespace shibsp {
     }
 };
 
-LocalLogoutInitiator::LocalLogoutInitiator(const ptree& pt)
-    : AbstractHandler(pt, Category::getInstance(SHIBSP_LOGCAT ".LogoutInitiator.Local"))
+LocalLogoutInitiator::LocalLogoutInitiator(const ptree& pt) : AbstractHandler(pt)
 {
 }
 
@@ -77,7 +76,7 @@ pair<bool,long> LocalLogoutInitiator::run(SPRequest& request, bool isHandler) co
         session = request.getSession(false, true);  // don't cache it and ignore all checks
     }
     catch (const std::exception& ex) {
-        m_log.error("error accessing current session: %s", ex.what());
+        request.error(string("error accessing current session: ") + ex.what());
     }
 
     if (session) {
diff --git a/shibsp/handler/impl/MetadataGenerator.cpp b/shibsp/handler/impl/MetadataGenerator.cpp
index 9de7a175..8de268b9 100644
--- a/shibsp/handler/impl/MetadataGenerator.cpp
+++ b/shibsp/handler/impl/MetadataGenerator.cpp
@@ -63,8 +63,7 @@ namespace shibsp {
 
 };
 
-MetadataGenerator::MetadataGenerator(const ptree& pt)
-    : SecuredHandler(pt, Category::getInstance(SHIBSP_LOGCAT ".Handler.Metadata"))
+MetadataGenerator::MetadataGenerator(const ptree& pt) : SecuredHandler(pt)
 {
     const char* bases = getString("baseURLs");
     if (bases) {
@@ -82,8 +81,8 @@ pair<bool,long> MetadataGenerator::run(SPRequest& request, bool isHandler) const
     try {
         // TODO
     }
-    catch (exception& ex) {
-        m_log.error("error while processing request: %s", ex.what());
+    catch (const exception& ex) {
+        request.error(string("error while processing request: ") + ex.what());
         istringstream msg("Metadata Request Failed");
         return make_pair(true, request.sendResponse(msg, HTTPResponse::SHIBSP_HTTP_STATUS_ERROR));
     }
diff --git a/shibsp/handler/impl/SecuredHandler.cpp b/shibsp/handler/impl/SecuredHandler.cpp
index 33e3cf4a..d97d87b9 100644
--- a/shibsp/handler/impl/SecuredHandler.cpp
+++ b/shibsp/handler/impl/SecuredHandler.cpp
@@ -31,8 +31,8 @@ using namespace shibsp;
 using namespace boost::property_tree;
 using namespace std;
 
-SecuredHandler::SecuredHandler(const ptree& pt, Category& log, const char* aclProperty, const char* defaultACL)
-    : AbstractHandler(pt, log)
+SecuredHandler::SecuredHandler(const ptree& pt, const char* aclProperty, const char* defaultACL)
+    : AbstractHandler(pt)
 {
     const char* acl = getString(aclProperty, defaultACL);
     if (acl) {
@@ -41,7 +41,7 @@ SecuredHandler::SecuredHandler(const ptree& pt, Category& log, const char* aclPr
         for_each(aclarray.begin(), aclarray.end(), [this](const string& s){parseACL(s);});
 
         if (m_acl.empty()) {
-            m_log.warn("invalid CIDR range(s) in handler's acl property, allowing 127.0.0.1 and ::1 as a fall back");
+            Category::getInstance(SHIBSP_LOGCAT "Handler").warn("invalid CIDR range(s) in handler's acl property, allowing 127.0.0.1 and ::1 as a fall back");
             m_acl.push_back(IPRange::parseCIDRBlock("127.0.0.1"));
             m_acl.push_back(IPRange::parseCIDRBlock("::1"));
         }
@@ -57,8 +57,8 @@ void SecuredHandler::parseACL(const string& acl)
     try {
         m_acl.push_back(IPRange::parseCIDRBlock(acl.c_str()));
     }
-    catch (exception& ex) {
-        m_log.error("invalid CIDR block (%s): %s", acl.c_str(), ex.what());
+    catch (const exception& ex) {
+        Category::getInstance(SHIBSP_LOGCAT "Handler").error("invalid CIDR block (%s): %s", + acl.c_str(), ex.what());
     }
 }
 
diff --git a/shibsp/handler/impl/SessionHandler.cpp b/shibsp/handler/impl/SessionHandler.cpp
index cbf41872..1a6d07d5 100644
--- a/shibsp/handler/impl/SessionHandler.cpp
+++ b/shibsp/handler/impl/SessionHandler.cpp
@@ -69,8 +69,7 @@ namespace shibsp {
 
 };
 
-SessionHandler::SessionHandler(const ptree& pt)
-    : SecuredHandler(pt, Category::getInstance(SHIBSP_LOGCAT ".Handler.Session")), m_values(false)
+SessionHandler::SessionHandler(const ptree& pt) : SecuredHandler(pt), m_values(false)
 {
     m_contentType = getString("contentType", "");
     if (!m_contentType.empty() && m_contentType != "application/json" && m_contentType != "text/html")
@@ -145,7 +144,7 @@ pair<bool,long> SessionHandler::doJSON(SPRequest& request) const
         }
     }
     catch (const exception& ex) {
-        m_log.info("exception accessing user session: %s", ex.what());
+        request.info(string("exception accessing user session: ") + ex.what());
         s << "{}" << endl;
         return make_pair(true, request.sendError(s));
     }
diff --git a/shibsp/handler/impl/SessionInitiator.cpp b/shibsp/handler/impl/SessionInitiator.cpp
index 499c6161..5d254b87 100644
--- a/shibsp/handler/impl/SessionInitiator.cpp
+++ b/shibsp/handler/impl/SessionInitiator.cpp
@@ -55,8 +55,7 @@ namespace shibsp {
 };
 
 SessionInitiator::SessionInitiator(const ptree& pt, const char* path)
-    : AbstractHandler(pt, Category::getInstance(SHIBSP_LOGCAT ".Handler.SessionInitiator")),
-        m_path(path), m_remotedHeaders({ "Cookie" })
+    : AbstractHandler(pt), m_path(path), m_remotedHeaders({ "Cookie" })
 {
     const char* settings = getString("requestMapperSettings");
     if (settings) {
@@ -186,11 +185,11 @@ pair<bool,long> SessionInitiator::run(SPRequest& request, bool isHandler) const
             }
 
             if (returnOnError) {
-                m_log.warn(ex.what());
+                request.warn(ex.what());
                 const char* error_target = agent_ex ? agent_ex->getProperty("target") : nullptr;
                 // Make sure the target isn't the same as this handler, to avoid a loop.
                 if (error_target && strcmp(error_target, handler.c_str())) {
-                    m_log.info("trapping SessionInitiator failure and returning to target location");
+                    request.info("trapping SessionInitiator failure and returning to target location");
                     request.limitRedirect(error_target);
                     return make_pair(true, request.sendRedirect(error_target));
                 }
diff --git a/shibsp/handler/impl/StatusHandler.cpp b/shibsp/handler/impl/StatusHandler.cpp
index a4283070..3483cf3e 100644
--- a/shibsp/handler/impl/StatusHandler.cpp
+++ b/shibsp/handler/impl/StatusHandler.cpp
@@ -23,7 +23,6 @@
 #include "Agent.h"
 #include "SPRequest.h"
 #include "handler/SecuredHandler.h"
-#include "logging/Category.h"
 #include "session/SessionCache.h"
 #include "util/CGIParser.h"
 #include "util/Date.h"
@@ -193,8 +192,7 @@ namespace shibsp {
     }
 };
 
-StatusHandler::StatusHandler(const ptree& pt)
-    : SecuredHandler(pt, Category::getInstance(SHIBSP_LOGCAT ".Handler.Status"))
+StatusHandler::StatusHandler(const ptree& pt) : SecuredHandler(pt)
 {
 }
 
@@ -235,7 +233,7 @@ pair<bool,long> StatusHandler::run(SPRequest& request, bool isHandler) const
     }
 
     try {
-        m_log.debug("processing status request");
+        request.debug("processing status request");
 
         stringstream s;
         s << "<StatusHandler time='" << timestamp << "'>"
@@ -259,7 +257,7 @@ pair<bool,long> StatusHandler::run(SPRequest& request, bool isHandler) const
         return make_pair(true, request.sendResponse(s));
     }
     catch (std::exception& ex) {
-        m_log.error("error while processing request: %s", ex.what());
+        request.error(string("error while processing request: ") + ex.what());
         request.setContentType("text/xml");
         stringstream msg;
         msg << "<StatusHandler time='" << timestamp << "'>"
diff --git a/shibsp/handler/impl/TokenConsumer.cpp b/shibsp/handler/impl/TokenConsumer.cpp
index db98d6db..c80ae356 100644
--- a/shibsp/handler/impl/TokenConsumer.cpp
+++ b/shibsp/handler/impl/TokenConsumer.cpp
@@ -59,8 +59,7 @@ namespace shibsp {
 };
 
 TokenConsumer::TokenConsumer(const ptree& pt, const char* path)
-    : AbstractHandler(pt, Category::getInstance(SHIBSP_LOGCAT ".Handler.TokenConsumer")),
-        m_path(path), m_remotedHeaders({ "Cookie" })
+    : AbstractHandler(pt), m_path(path), m_remotedHeaders({ "Cookie" })
 {
 }
 
@@ -158,11 +157,9 @@ pair<bool,long> TokenConsumer::run(SPRequest& request, bool isHandler) const
                 request.limitRedirect(error_target);
                 // Make sure the target isn't a prefix of this handler, to avoid a loop.
                 if (boost::starts_with(error_target, request.getRequestURL())) {
-                    request.log(Priority::SHIB_WARN,
-                        "TokenConsumer target location matched handler, not trapping passive request error");
+                    request.warn("TokenConsumer target location matched handler, not trapping passive request error");
                 } else {
-                    request.log(Priority::SHIB_INFO,
-                        "trapping TokenConsumer failure and returning to target location for passive request");
+                    request.info("trapping TokenConsumer failure and returning to target location for passive request");
                     return make_pair(true, request.sendRedirect(error_target));
                 }
             }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list