logging from fcgi

Doru Georgescu <headset001-/[email protected]> Wed, 19 Sep 2012 08:41:59 -0700 (PDT)
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
In short, I print into some /var/log/apache2/myapp.log file from a fcgi app=
lication under apache. You can see the configuration changes which I perfor=
med after the "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D" line.

As a result:
in /etc/cron.daily/sysklogd:
Code:

/etc/init.d/sysklogd reload-or-restart > /dev/null

calls:
in /etc/init.d/sysklogd:
Code:

sudo start-stop-daemon --stop --quiet --signal 1 --pidfile /var/run/syslogd=
.pid --name syslogd

and myapp.fcgi stops writing to myapp.log and it stays like that.

I changed:
in /etc/cron.daily/sysklogd:
Code:

/etc/init.d/sysklogd restart > /dev/null

and now:
Code:

sudo logrotate -f /etc/logrotate.conf

restarts all apache2 processes excepting one and kills myapp.fcgi.

It appears that the combination of apache2, fcgi and syslog makes a perfect=
 mess of my logging. Of course, all system and apache2 native logging works=
 flawlessly. Anybody with some experience in linux, please give me any advi=
ce. Do I have a chance to solve this?

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Configuration:

I am using Ubuntu 8.04 lts server, Apache web server.

My (fast cgi) application uses:
Code:

#include <syslog.h>
syslog(LOG_LOCAL6|LOG_INFO, "new n=3D %d;\n", count);

to log some activity messages.
At the end of /etc/syslog.conf I added:
Code:

local6.=3Dinfo -/var/log/apache2/myapp.log

In /etc/syslog.conf I added to each selector which contained "myapp.log":
Code:

;local6.!=3Dinfo

like this:
Code:

*.*;auth,authpriv.none;local6.!=3Dinfo=A0 =A0 =A0 =A0 =A0 =A0 -/var/log/sys=
log

and:
Code:

*.=3Dinfo;*.=3Dnotice;*.=3Dwarn;\
=A0 =A0 =A0 =A0=A0=A0auth,authpriv.none;\
=A0 =A0 =A0 =A0=A0=A0cron,daemon.none;\
=A0 =A0 =A0 =A0=A0=A0mail,news.none;local6.!=3Dinfo=A0 =A0 =A0 =A0 =A0 =A0 =
-/var/log/messages