Re: save a log
Aron Szabo <aron-Iv/[email protected]> Sat, 14 Aug 2010 13:41:02 +0200
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <[email protected]> |
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!");
closelog();
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
pointless.hu
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-xGejAJT2w6xVgU18Zptdi0EOCMrvLtNR@public.gmane.org
> http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers