Hi,

documentation of ScriptLog says "If given, any CGI errors are logged into the filename given as argument". I have found out that errors printed by cgi script to stderr are not logged into ScriptLog and are just in error_log.

I'm not sure if that's intended behaviour or a bug, but I've created patch to fix this. Does anyone have an idea if this is documentation problem or bug in mod_cgi worth patching?

Note that the same problem exists also in mod_cgid, but I haven't checked out that module yet.

Regards,
Jan Kaluza
Index: modules/generators/mod_cgi.c
===================================================================
--- modules/generators/mod_cgi.c	(revision 1572062)
+++ modules/generators/mod_cgi.c	(working copy)
@@ -169,7 +169,7 @@
     char time_str[APR_CTIME_LEN];
     int log_flags = rv ? APLOG_ERR : APLOG_ERR;
 
-    ap_log_rerror(APLOG_MARK, log_flags, rv, r,
+    ap_log_rerror(APLOG_MARK, log_flags, rv, r, APLOGNO(01215)
                   "%s: %s", error, r->filename);
 
     /* XXX Very expensive mainline case! Open, then getfileinfo! */
@@ -203,6 +203,7 @@
     char argsbuffer[HUGE_STRING_LEN];
     char *newline;
     apr_status_t rv;
+    cgi_server_conf *conf = ap_get_module_config(r->server->module_config, &cgi_module);
 
     while ((rv = apr_file_gets(argsbuffer, HUGE_STRING_LEN,
                                script_err)) == APR_SUCCESS) {
@@ -210,8 +211,7 @@
         if (newline) {
             *newline = '\0';
         }
-        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01215)
-                      "%s", argsbuffer);
+        log_scripterror(r, conf, r->status, 0, argsbuffer);
     }
 
     return rv;

Reply via email to