1 --- Pound-2.4.3/config.c 2008-12-11 00:55:24.275734964 +0200
2 +++ Pound-2.4.3-logfile/config.c 2008-12-11 00:22:22.509353295 +0200
7 -static regex_t Empty, Comment, User, Group, RootJail, Daemon, LogFacility, LogLevel, Alive, SSLEngine, Control;
8 +static regex_t Empty, Comment, User, Group, RootJail, Daemon, LogFacility, LogFile, LogLevel, Alive, SSLEngine, Control;
9 static regex_t ListenHTTP, ListenHTTPS, End, Address, Port, Cert, xHTTP, Client, CheckURL;
10 static regex_t Err414, Err500, Err501, Err503, MaxRequest, HeadRemove, RewriteLocation, RewriteDestination;
11 static regex_t Service, ServiceName, URL, HeadRequire, HeadDeny, BackEnd, Emergency, Priority, HAport, HAportAddr;
12 @@ -1104,6 +1104,14 @@
13 def_facility = facilitynames[i].c_val;
16 + } else if(!regexec(&LogFile, lin, 4, matches, 0)) {
17 + lin[matches[1].rm_eo] = '\0';
18 + if((log_file = strdup(lin + matches[1].rm_so)) == NULL) {
19 + logmsg(LOG_ERR, "line %d: LogFile config: out of memory - aborted", n_lin);
22 + // force facility to log stdout internally.
24 } else if(!regexec(&Grace, lin, 4, matches, 0)) {
25 grace = atoi(lin + matches[1].rm_so);
26 } else if(!regexec(&LogLevel, lin, 4, matches, 0)) {
28 || regcomp(&RootJail, "^[ \t]*RootJail[ \t]+\"(.+)\"[ \t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED)
29 || regcomp(&Daemon, "^[ \t]*Daemon[ \t]+([01])[ \t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED)
30 || regcomp(&LogFacility, "^[ \t]*LogFacility[ \t]+([a-z0-9-]+)[ \t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED)
31 + || regcomp(&LogFile, "^[ \t]*LogFile[ \t]+(.+)[ \t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED)
32 || regcomp(&LogLevel, "^[ \t]*LogLevel[ \t]+([0-5])[ \t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED)
33 || regcomp(&Grace, "^[ \t]*Grace[ \t]+([0-9]+)[ \t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED)
34 || regcomp(&Alive, "^[ \t]*Alive[ \t]+([1-9][0-9]*)[ \t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED)
46 regfree(&LogFacility);
51 --- Pound-2.4.3-logfile/pound.c 2008-12-11 00:51:21.169092412 +0200
52 +++ Pound-2.4.3.logs/pound.c 2009-01-08 18:03:00.316961385 +0200
54 *group, /* group to run as */
55 *root_jail, /* directory to chroot to */
56 *pid_name, /* file to record pid in */
57 + *log_file, /* print log messages to this file, instead of syslog */
58 + *error_log, /* print error messages to this file, instead of syslog */
59 *ctrl_name; /* control socket name */
61 int alive_to, /* check interval for resurrection */
63 /* daemonize - make ourselves a subprocess. */
66 - if(log_facility != -1) {
72 + stdout = freopen(log_file, "a", stdout);
75 + if (log_facility != -1) {
80 + stderr = freopen(error_log, "a", stderr);
83 + if (log_facility != -1) {
89 --- Pound-2.4.3-logfile/pound.h 2008-12-11 00:16:43.449299956 +0200
90 +++ Pound-2.4.3.logs/pound.h 2009-01-08 17:47:38.940178535 +0200
92 *group, /* group to run as */
93 *root_jail, /* directory to chroot to */
94 *pid_name, /* file to record pid in */
95 + *log_file, /* print log messages to this file, instead of syslog */
96 + *error_log, /* print error messages to this file, instead of syslog */
97 *ctrl_name; /* control socket name */
99 extern int alive_to, /* check interval for resurrection */
100 --- Pound-2.4.3/svc.c 2009-01-08 18:20:02.970625040 +0200
101 +++ Pound-2.4.3.logs/svc.c 2009-01-08 18:16:21.407506564 +0200
102 @@ -176,13 +176,25 @@
103 char buf[MAXBUF + 1];
105 struct tm *t_now, t_res;
106 + int log = (priority == LOG_INFO || priority == LOG_DEBUG);
110 vsnprintf(buf, MAXBUF, fmt, ap);
112 - if(log_facility == -1) {
113 - fprintf((priority == LOG_INFO || priority == LOG_DEBUG)? stdout: stderr, "%s\n", buf);
115 + // if access log or error log are set, use them.
116 + if (log && log_file) {
117 + printf("%s\n", buf);
118 + fprintf(stdout, "%s\n", buf);
121 + if (!log && error_log) {
122 + fprintf(stderr, "%s\n", buf);
125 + if (log_facility == -1) {
126 + fprintf(log ? stdout : stderr, "%s\n", buf);