You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ja...@keypartners.fi on 2003/12/01 13:06:13 UTC

[users@httpd] stderr not working with C cgi-bins

Hi,

I am running apache 1.3 on Solaris 8 and developing cgi-bins with C. For
all I know, everything works fine except that I am unable to get writes to
stderr to appear in error_log. I have a simple test cgi-bin program:

- - - - - - 8< - - - - - -

#include <stdio.h>

int main() {
   printf("Content-Type: text/html\r\n\r\n");
   printf("<html> <head>\n");
   printf("<title>Hello, World !</title>\n");
   printf("</head>\n");
   printf("<body>\n");
   printf("<h1>Hello, World!</h1>\n");
   fprintf(stderr, "debug message to stderr\n\n");
   fprintf(stdout, "debug message to stdout\n\n");
}

- - - - - - 8< - - - - - -

Accessing cgi-bin/helloworld.cgi produces the logical output, including the
debug messages printed to stdout. Nothing goes to error_log - I am
expecting to get the debug messages there. Running the compiled cgi-bin
from shell displays both stderr and stout writes.

On httpd.conf I have settings:

- - - - - - 8< - - - - - -

ErrorLog /etc/apache/logs/error_log
ScriptLog /etc/apache/logs/script_log
LogLevel debug
CustomLog logs/access_log combined

<VirtualHost _default_:443>
ErrorLog /etc/apache/logs/error_log
TransferLog /etc/apache/logs/access_log
...
CustomLog logs/ssl_request_log \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost>

- - - - - - 8< - - - - - -

As far as I know, start up scripts do not redirect stderr anywhere.

error_log works at least somehow, when I try to access non-existing cgi-bin
I get logical error messages to error_log and script_log.

Any ideas what could be wrong?

- - -
Janne Mattila




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org