httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Olsen <>
Subject [PATCH] Adding referer info to error_log
Date Tue, 25 Apr 2000 21:29:10 GMT
I wrote this to help debug a bunch of contractor-provided web pages.  We
had lots of error messages of missing images and pages, with no clue of
where to find what was referencing the page.  (I find it strange that you
can modify every log file in Apache *except* the error_log.  Any reason
for this or just an oversight? (But if you speced it wrong, where would
you write the errors?))

This is real quick and dirty.  It took less than 15 minutes to research
and write.  It seems to work fine on my machine, but who knows what it
will do to yours.  It probably has at least one thing done wrong.  The
patch parameters are probably wrong, but since it has been many years
since I have generated a patch, you get what you pay for.

The file being modified is src/main/http_log.c.

------- cut here ----------

--- http_log.c	Wed Feb  2 12:43:49 2000
+++	Tue Apr 25 02:04:33 2000
@@ -388,6 +388,11 @@
 	len += ap_snprintf(errstr + len, sizeof(errstr) - len,
 		"[client %s] ", r->connection->remote_ip);
+    if (r && r->headers_in) {
+        /* A hack to add referer to error_log - aro 04/24/00 */
+        len += ap_snprintf(errstr + len, sizeof(errstr) - len,
+                "[referer %s] ", ap_table_get(r->headers_in,"Referer") );
+    }
     if (!(level & APLOG_NOERRNO)
 	&& (save_errno != 0)
 #ifdef WIN32

---- end of patch condition reached --- | Note to AOL users: for a quick shortcut to reply
Alan Olsen            | to my mail, just hit the ctrl, alt and del keys.
    "In the future, everything will have its 15 minutes of blame."

View raw message