improve sessionhandler trace logging

Sun, 15 Sep 2024 09:47:36 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 15 Sep 2024 09:47:36 +0200
changeset 558
0e79e17c70e2
parent 557
e35829a3a6d8
child 559
3966dc878a28

improve sessionhandler trace logging

src/server/daemon/httprequest.c file | annotate | diff | comparison | revisions
src/server/daemon/sessionhandler.c file | annotate | diff | comparison | revisions
--- a/src/server/daemon/httprequest.c	Fri Sep 13 23:19:04 2024 +0200
+++ b/src/server/daemon/httprequest.c	Sun Sep 15 09:47:36 2024 +0200
@@ -516,7 +516,7 @@
  */
 
 int nsapi_handle_request(NSAPISession *sn, NSAPIRequest *rq) {
-    log_ereport(LOG_DEBUG, "trace reqid: %016llx nsapi_handle_request", (unsigned long long int)sn->connection->id);
+    log_ereport(LOG_DEBUG, "trace reqid: %016llx nsapi_handle_request %d", (unsigned long long int)sn->connection->id, rq->phase);
     
     int r = REQ_NOACTION;
     do {
@@ -667,7 +667,7 @@
          * unref it
          */
     } else {
-        log_ereport(LOG_DEBUG, "trace reqid: %016llx connection destroyed | keep_alive failed", (unsigned long long int)sn->connection->id);
+        log_ereport(LOG_DEBUG, "trace reqid: %016llx connection: close", (unsigned long long int)sn->connection->id);
         connection_destroy(sn->connection);
     }
     
--- a/src/server/daemon/sessionhandler.c	Fri Sep 13 23:19:04 2024 +0200
+++ b/src/server/daemon/sessionhandler.c	Sun Sep 15 09:47:36 2024 +0200
@@ -100,6 +100,7 @@
 }
 
 void connection_destroy(Connection *conn) {
+    log_ereport(LOG_DEBUG, "trace reqid: %016llx connection_destroy", (unsigned long long int)conn->id);
     cfg_unref(conn->listener->cfg);
     conn->close(conn);
     if(conn->ssl) {
@@ -230,6 +231,8 @@
     EventHttpIO *io = item->data1;
     io->error = 4;
     
+    log_ereport(LOG_DEBUG, "trace reqid: %016llx request timeout", (unsigned long long int)io->request->connection->id);
+    
     if(ev_remove_poll(h, io->request->connection->fd)) {
         log_ereport(LOG_FAILURE, "sessionhandler: request timeout: cannot remove poll");
     }
@@ -552,6 +555,8 @@
     HttpParser  *parser  = io->parser;
     HTTPRequest *request = io->request;
     
+    log_ereport(LOG_DEBUG, "trace reqid: %016llx request error", (unsigned long long int)request->connection->id);
+    
     if(event->error) {
         log_ereport(LOG_VERBOSE, "sessionhandler http io error: %d fd: %d", io->error, request->connection->fd);
     }
@@ -675,7 +680,7 @@
         log_ereport(LOG_FAILURE, "sessionhandler: keep-alive timeout: cannot remove poll");
     }
     
-    log_ereport(LOG_DEBUG, "trace reqid: %016llx connection destroyed | keep_alive timeout", (unsigned long long int)conn->id);
+    log_ereport(LOG_DEBUG, "trace reqid: %016llx keep_alive timeout", (unsigned long long int)conn->id);
     connection_destroy(conn);
     free(ioevent);
     free(item);

mercurial