[FASTCGI] save a log

Aron Szabo aron at aron.ws
Sat Aug 14 07:41:02 EDT 2010

  Hi Doru!

You can use syslog this way:

#include <stdio.h>
#include <unistd.h>
#include <syslog.h>

int main(void) {

  openlog("slog", LOG_PID|LOG_CONS, LOG_USER);
  syslog(LOG_INFO, "Hello world!");

  return 0;

In my opinion It's not insecure to have a file to witch the www user can 
write, but don't allow it on the whole directory!

Yours sincerely,
Aron Szabo
Pointless Software

On 08/14/2010 01:30 PM, Doru Georgescu wrote:
> "  Hi Doru!
> You should be able to write to the disk normally.
> The data does not get flushed to the disk.
> Try flushing the data to the disk with fflush(mylog);, or closing the
> file after the program ends. "
> Thank you very much for this tip.
> Files are flushed and closed automatically when a process exits normally, but in this case the process never exits normally. Since I wrote very little to mylog, the buffer was never flushed automatically.
> This page:
> http://httpd.apache.org/docs/2.2/misc/security_tips.html#serverroot
> says that it might be dangerous if I allow www-data (apache's user) to write to /var/log. Should I believe them, even if I'm the only user on the system?
> I got an ugly "Segmentation fault" error when I didn't answer anything to the request. Simultaneously I was testing logging on a different fcgi program, and I forgot about my MaxProcessCount setting of 1, such that I had a good time. :)
> For some reason, google can not search in this list's archive, even though that would be very useful.
> Thank you all for your patience,
> Doru
> _______________________________________________
> FastCGI-developers mailing list
> FastCGI-developers at mailman.fastcgi.com
> http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers

More information about the FastCGI-developers mailing list