From: Elan Ruusamäe Date: Wed, 10 Dec 2008 22:58:58 +0000 (+0000) Subject: - add LogFile directive support, opens stdout there if defined X-Git-Tag: auto/ac/pound-2_4_3-3~2 X-Git-Url: http://git.pld-linux.org/gitweb.cgi?a=commitdiff_plain;h=c94e34ab6a23698be545fef1f564d573aee1b0ed;p=packages%2Fpound.git - add LogFile directive support, opens stdout there if defined Changed files: pound-logfile.patch -> 1.1 --- diff --git a/pound-logfile.patch b/pound-logfile.patch new file mode 100644 index 0000000..d5e1bb3 --- /dev/null +++ b/pound-logfile.patch @@ -0,0 +1,80 @@ +--- Pound-2.4.3/config.c 2008-12-11 00:55:24.275734964 +0200 ++++ Pound-2.4.3-logfile/config.c 2008-12-11 00:22:22.509353295 +0200 +@@ -72,7 +72,7 @@ + }; + #endif + +-static regex_t Empty, Comment, User, Group, RootJail, Daemon, LogFacility, LogLevel, Alive, SSLEngine, Control; ++static regex_t Empty, Comment, User, Group, RootJail, Daemon, LogFacility, LogFile, LogLevel, Alive, SSLEngine, Control; + static regex_t ListenHTTP, ListenHTTPS, End, Address, Port, Cert, xHTTP, Client, CheckURL; + static regex_t Err414, Err500, Err501, Err503, MaxRequest, HeadRemove, RewriteLocation, RewriteDestination; + static regex_t Service, ServiceName, URL, HeadRequire, HeadDeny, BackEnd, Emergency, Priority, HAport, HAportAddr; +@@ -1104,6 +1104,14 @@ + def_facility = facilitynames[i].c_val; + break; + } ++ } else if(!regexec(&LogFile, lin, 4, matches, 0)) { ++ lin[matches[1].rm_eo] = '\0'; ++ if((log_file = strdup(lin + matches[1].rm_so)) == NULL) { ++ logmsg(LOG_ERR, "line %d: LogFile config: out of memory - aborted", n_lin); ++ exit(1); ++ } ++ // force facility to log stdout internally. ++ def_facility = -1; + } else if(!regexec(&Grace, lin, 4, matches, 0)) { + grace = atoi(lin + matches[1].rm_so); + } else if(!regexec(&LogLevel, lin, 4, matches, 0)) { +@@ -1204,6 +1212,7 @@ + || regcomp(&RootJail, "^[ \t]*RootJail[ \t]+\"(.+)\"[ \t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED) + || regcomp(&Daemon, "^[ \t]*Daemon[ \t]+([01])[ \t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED) + || regcomp(&LogFacility, "^[ \t]*LogFacility[ \t]+([a-z0-9-]+)[ \t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED) ++ || regcomp(&LogFile, "^[ \t]*LogFile[ \t]+(.+)[ \t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED) + || regcomp(&LogLevel, "^[ \t]*LogLevel[ \t]+([0-5])[ \t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED) + || regcomp(&Grace, "^[ \t]*Grace[ \t]+([0-9]+)[ \t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED) + || regcomp(&Alive, "^[ \t]*Alive[ \t]+([1-9][0-9]*)[ \t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED) +@@ -1329,6 +1338,7 @@ + group = NULL; + root_jail = NULL; + ctrl_name = NULL; ++ log_file = NULL; + + alive_to = 30; + daemonize = 1; +@@ -1358,6 +1368,7 @@ + regfree(&RootJail); + regfree(&Daemon); + regfree(&LogFacility); ++ regfree(&LogFile); + regfree(&LogLevel); + regfree(&Grace); + regfree(&Alive); +--- Pound-2.4.3/pound.c 2008-05-31 13:25:43.000000000 +0300 ++++ Pound-2.4.3-logfile/pound.c 2008-12-11 00:51:21.169092412 +0200 +@@ -33,6 +33,7 @@ + *group, /* group to run as */ + *root_jail, /* directory to chroot to */ + *pid_name, /* file to record pid in */ ++ *log_file, /* print log messages to this file */ + *ctrl_name; /* control socket name */ + + int alive_to, /* check interval for resurrection */ +@@ -294,6 +295,9 @@ + close(0); + close(1); + close(2); ++ } else if (log_file) { ++ freopen(log_file, "a", stdout); ++ setlinebuf(stdout); + } + break; + case -1: +--- Pound-2.4.3/pound.h 2008-05-31 13:25:43.000000000 +0300 ++++ Pound-2.4.3-logfile/pound.h 2008-12-11 00:16:43.449299956 +0200 +@@ -236,6 +236,7 @@ + *group, /* group to run as */ + *root_jail, /* directory to chroot to */ + *pid_name, /* file to record pid in */ ++ *log_file, /* print log messages to this file */ + *ctrl_name; /* control socket name */ + + extern int alive_to, /* check interval for resurrection */