fixed syslog support

This commit is contained in:
roberto@natty32
2011-04-04 17:17:47 +02:00
parent 9cc4db1a12
commit c04131af4b
2 changed files with 10 additions and 1 deletions
+9 -1
View File
@@ -188,12 +188,18 @@ void logto(char *logfile) {
void log_syslog(char *syslog_opts) {
if (syslog_opts == NULL) {
syslog_opts= "uwsgi";
}
if (socketpair(AF_UNIX, SOCK_DGRAM, 0, uwsgi.shared->worker_log_pipe)) {
uwsgi_error("socketpair()\n");
exit(1);
}
#ifdef UWSGI_DEBUG
uwsgi_log("log pipe %d %d\n", uwsgi.shared->worker_log_pipe[0], uwsgi.shared->worker_log_pipe[1]);
#endif
if (uwsgi.shared->worker_log_pipe[1] != 1) {
if (dup2(uwsgi.shared->worker_log_pipe[1], 1) < 0) {
@@ -203,14 +209,16 @@ void log_syslog(char *syslog_opts) {
}
#ifdef UWSGI_DEBUG
uwsgi_log("opening syslog\n");
#endif
if (dup2(1, 2) < 0) {
uwsgi_error("dup2()");
exit(1);
}
openlog("uwsgi", 0, LOG_DAEMON );
openlog(syslog_opts, 0, LOG_DAEMON );
}
+1
View File
@@ -2360,6 +2360,7 @@ end:
log_syslog(optarg);
uwsgi.log_syslog = 1;
uwsgi.log_master = 1;
uwsgi.master_process = 1;
return 1;
case LONG_ARGS_PRINT:
uwsgi_log("%s\n", optarg);