]>
Commit | Line | Data |
---|---|---|
c94e34ab ER |
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 | |
3 | @@ -72,7 +72,7 @@ | |
4 | }; | |
5 | #endif | |
6 | ||
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; | |
14 | break; | |
15 | } | |
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); | |
20 | + exit(1); | |
21 | + } | |
41fabe4f ER |
22 | + // force facility to log stdout internally. |
23 | + def_facility = -1; | |
c94e34ab ER |
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)) { | |
27 | @@ -1204,6 +1212,7 @@ | |
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) | |
35 | @@ -1329,6 +1338,7 @@ | |
36 | group = NULL; | |
37 | root_jail = NULL; | |
38 | ctrl_name = NULL; | |
39 | + log_file = NULL; | |
40 | ||
41 | alive_to = 30; | |
42 | daemonize = 1; | |
43 | @@ -1358,6 +1368,7 @@ | |
44 | regfree(&RootJail); | |
45 | regfree(&Daemon); | |
46 | regfree(&LogFacility); | |
47 | + regfree(&LogFile); | |
48 | regfree(&LogLevel); | |
49 | regfree(&Grace); | |
50 | regfree(&Alive); | |
51 | --- Pound-2.4.3/pound.c 2008-05-31 13:25:43.000000000 +0300 | |
52 | +++ Pound-2.4.3-logfile/pound.c 2008-12-11 00:51:21.169092412 +0200 | |
53 | @@ -33,6 +33,7 @@ | |
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 */ | |
58 | *ctrl_name; /* control socket name */ | |
59 | ||
60 | int alive_to, /* check interval for resurrection */ | |
61 | @@ -294,6 +295,9 @@ | |
62 | close(0); | |
63 | close(1); | |
64 | close(2); | |
65 | + } else if (log_file) { | |
66 | + freopen(log_file, "a", stdout); | |
67 | + setlinebuf(stdout); | |
68 | } | |
69 | break; | |
70 | case -1: | |
71 | --- Pound-2.4.3/pound.h 2008-05-31 13:25:43.000000000 +0300 | |
72 | +++ Pound-2.4.3-logfile/pound.h 2008-12-11 00:16:43.449299956 +0200 | |
73 | @@ -236,6 +236,7 @@ | |
74 | *group, /* group to run as */ | |
75 | *root_jail, /* directory to chroot to */ | |
76 | *pid_name, /* file to record pid in */ | |
77 | + *log_file, /* print log messages to this file */ | |
78 | *ctrl_name; /* control socket name */ | |
79 | ||
80 | extern int alive_to, /* check interval for resurrection */ |