[cpp-sp] branch main updated: Adjust use of log context feature.

Codeberg noreply at shibboleth.net
Tue Feb 17 18:57:52 UTC 2026


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

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

View the commit online:
https://codeberg.org/Shibboleth/cpp-sp/commit/f02c3bcc2ceb1e8a49610517b0a50d14a9249810

The following commit(s) were added to refs/heads/main by this push:
     new f02c3bcc Adjust use of log context feature.
f02c3bcc is described below

commit f02c3bcc2ceb1e8a49610517b0a50d14a9249810
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Feb 17 13:57:36 2026 -0500

    Adjust use of log context feature.
---
 apache/mod_shib4.cpp         |  3 ---
 shibsp/AbstractSPRequest.cpp | 11 ++++++++++-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/apache/mod_shib4.cpp b/apache/mod_shib4.cpp
index ef546823..90817d8e 100644
--- a/apache/mod_shib4.cpp
+++ b/apache/mod_shib4.cpp
@@ -330,9 +330,6 @@ public:
   string getLocalAddr() const {
     return m_req->connection->local_ip;
   }
-  const char* getLogContext() {
-    return m_req->log_id;
-  }
   const char* getQueryString() const { return m_req->args; }
   const char* getRequestBody() const {
     if (m_gotBody || m_req->method_number==M_GET)
diff --git a/shibsp/AbstractSPRequest.cpp b/shibsp/AbstractSPRequest.cpp
index 34cf6c29..6c9d160c 100644
--- a/shibsp/AbstractSPRequest.cpp
+++ b/shibsp/AbstractSPRequest.cpp
@@ -462,14 +462,18 @@ void AbstractSPRequest::setAuthType(const char* authtype)
 }
 
 const char* AbstractSPRequest::getLogContext() const{
-    return nullptr;
+    return getRequestID();
 }
 
 void AbstractSPRequest::log(Priority::Value level, const exception& e) const
 {
+    const char* ctx = getLogContext();
     const AgentException* rich_ex = dynamic_cast<const AgentException*>(&e);
     if (rich_ex) {
         ostringstream msg;
+        if (ctx) {
+            msg << ctx << ' ';
+        }
         msg << e.what() << " [";
 
         // Dump properties and status code.
@@ -485,6 +489,11 @@ void AbstractSPRequest::log(Priority::Value level, const exception& e) const
 
         log(level, msg.str());
     }
+    else if (ctx) {
+        string s(ctx);
+        s = s + ' ' + e.what();
+        log(level, s);
+    }
     else {
         log(level, e.what());
     }

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


More information about the commits mailing list