Received: (qmail 32140 invoked by uid 501); 8 Jun 2000 08:11:37 -0000 Message-Id: <20000608081137.32139.qmail@locus.apache.org> Date: 8 Jun 2000 08:11:37 -0000 From: Hardy Braunsdorf Reply-To: hardy.braunsdorf@metechnology.com To: submit@bugz.apache.org Subject: Ouputs to stderr from a cgi-program was not written in error.log. X-Send-Pr-Version: 3.110 >Number: 6161 >Category: mod_cgi >Synopsis: Ouputs to stderr from a cgi-program was not written in error.log. >Confidential: no >Severity: non-critical >Priority: medium >Responsible: apache >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: apache >Arrival-Date: Thu Jun 08 01:20:01 PDT 2000 >Closed-Date: Wed Dec 13 10:03:00 PST 2000 >Last-Modified: Wed Dec 13 10:03:00 PST 2000 >Originator: hardy.braunsdorf@metechnology.com >Release: 1.3.12/Win32 >Organization: >Environment: Windows NT 4.0 Server SP 4 Visual C++ 5.0 SP3 >Description: I use a cgi-program, that report errors to the stderr. Under unix-systems i see this output in the apache-errorlog. >How-To-Repeat: #include int main() { fprintf(stderr,"Test stderr under Windows NT\n"); printf("Content-Type: text/html\n\n"); printf("Testpage\n"); return 0; } >Fix: *** mod_cgi.c Thu Jun 8 10:06:56 2000 --- mod_cgi.c.own Thu Jun 8 10:06:48 2000 *************** *** 520,525 **** --- 520,538 ---- ap_checkconv(r); #endif /*CHARSET_EBCDIC*/ + #if defined(WIN32) || defined(NETWARE) + /* Soak up stderr and redirect it to the error log. + * Script output to stderr is already directed to the error log + * on Unix, thanks to the magic of fork(). + */ + while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) { + ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, + "%s", argsbuffer); + } + #else + while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) + continue; + #endif location = ap_table_get(r->headers_out, "Location"); if (location && location[0] == '/' && r->status == 200) { >Release-Note: >Audit-Trail: State-Changed-From-To: open-analyzed State-Changed-By: wrowe State-Changed-When: Sun Oct 1 11:31:24 PDT 2000 State-Changed-Why: Reasonable solution... I'll review it in a bit. Thanks for the patch and interest in the Apache project. Release-Changed-From-To: 1.3.12-1.3.12/Win32 Release-Changed-By: wrowe Release-Changed-When: Sun Oct 1 11:31:24 PDT 2000 State-Changed-From-To: analyzed-closed State-Changed-By: wrowe State-Changed-When: Wed Dec 13 10:03:00 PST 2000 State-Changed-Why: Applied in 1.3.15 ... thanks for your patch and interest in the Apache httpd project! >Unformatted: [In order for any reply to be added to the PR database, you need] [to include in the Cc line and make sure the] [subject line starts with the report component and number, with ] [or without any 'Re:' prefixes (such as "general/1098:" or ] ["Re: general/1098:"). If the subject doesn't match this ] [pattern, your message will be misfiled and ignored. The ] ["apbugs" address is not added to the Cc line of messages from ] [the database automatically because of the potential for mail ] [loops. If you do not include this Cc, your reply may be ig- ] [nored unless you are responding to an explicit request from a ] [developer. Reply only with text; DO NOT SEND ATTACHMENTS! ]