diff options
| author | Arno Töll <arno@debian.org> | 2013-12-23 23:50:09 -1100 |
|---|---|---|
| committer | Arno Töll <arno@debian.org> | 2013-12-23 23:50:09 -1100 |
| commit | 86d5cc79d9d6750da8771fdb0c9ab22c19b8ad45 (patch) | |
| tree | 5037da70bf37c0ee93f0ea09f054bdfb278befe0 /modules/loggers | |
| parent | 4a336a5b117419c33c29eadd6409c69df78cd586 (diff) | |
| download | apache2-86d5cc79d9d6750da8771fdb0c9ab22c19b8ad45.tar.gz | |
Imported Upstream version 2.4.7upstream/2.4.7
Diffstat (limited to 'modules/loggers')
| -rw-r--r-- | modules/loggers/mod_log_config.c | 14 | ||||
| -rw-r--r-- | modules/loggers/mod_logio.c | 19 |
2 files changed, 21 insertions, 12 deletions
diff --git a/modules/loggers/mod_log_config.c b/modules/loggers/mod_log_config.c index e1a82041..f17e1641 100644 --- a/modules/loggers/mod_log_config.c +++ b/modules/loggers/mod_log_config.c @@ -194,8 +194,8 @@ static void *ap_default_log_writer_init(apr_pool_t *p, server_rec *s, static void *ap_buffered_log_writer_init(apr_pool_t *p, server_rec *s, const char* name); -static ap_log_writer_init* ap_log_set_writer_init(ap_log_writer_init *handle); -static ap_log_writer* ap_log_set_writer(ap_log_writer *handle); +static ap_log_writer_init *ap_log_set_writer_init(ap_log_writer_init *handle); +static ap_log_writer *ap_log_set_writer(ap_log_writer *handle); static ap_log_writer *log_writer = ap_default_log_writer; static ap_log_writer_init *log_writer_init = ap_default_log_writer_init; static int buffered_logs = 0; /* default unbuffered */ @@ -1507,7 +1507,7 @@ static void ap_register_log_handler(apr_pool_t *p, char *tag, apr_hash_set(log_hash, tag, 1, (const void *)log_struct); } -static ap_log_writer_init* ap_log_set_writer_init(ap_log_writer_init *handle) +static ap_log_writer_init *ap_log_set_writer_init(ap_log_writer_init *handle) { ap_log_writer_init *old = log_writer_init; log_writer_init = handle; @@ -1536,6 +1536,10 @@ static apr_status_t ap_default_log_writer( request_rec *r, int i; apr_status_t rv; + /* + * We do this memcpy dance because write() is atomic for len < PIPE_BUF, + * while writev() need not be. + */ str = apr_palloc(r->pool, len + 1); for (i = 0, s = str; i < nelts; ++i) { @@ -1616,6 +1620,10 @@ static apr_status_t ap_buffered_log_writer(request_rec *r, if (len >= LOG_BUFSIZE) { apr_size_t w; + /* + * We do this memcpy dance because write() is atomic for + * len < PIPE_BUF, while writev() need not be. + */ str = apr_palloc(r->pool, len + 1); for (i = 0, s = str; i < nelts; ++i) { memcpy(s, strs[i], strl[i]); diff --git a/modules/loggers/mod_logio.c b/modules/loggers/mod_logio.c index f58c2922..ad387a9b 100644 --- a/modules/loggers/mod_logio.c +++ b/modules/loggers/mod_logio.c @@ -15,15 +15,7 @@ */ /* - * Written by Bojan Smojver <bojan rexursive.com>: - * - * The argument to LogFormat and CustomLog is a string, which can include - * literal characters copied into the log files, and '%' directives as - * follows: - * - * %...I: bytes received, including request and headers, cannot be zero - * %...O: bytes sent, including headers, cannot be zero - * + * Written by Bojan Smojver <bojan rexursive.com>. */ #include "apr_strings.h" @@ -108,6 +100,14 @@ static const char *log_bytes_out(request_rec *r, char *a) return apr_off_t_toa(r->pool, cf->bytes_out); } +static const char *log_bytes_combined(request_rec *r, char *a) +{ + logio_config_t *cf = ap_get_module_config(r->connection->conn_config, + &logio_module); + + return apr_off_t_toa(r->pool, cf->bytes_out + cf->bytes_in); +} + /* * Reset counters after logging... */ @@ -170,6 +170,7 @@ static int logio_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp) if (log_pfn_register) { log_pfn_register(p, "I", log_bytes_in, 0); log_pfn_register(p, "O", log_bytes_out, 0); + log_pfn_register(p, "S", log_bytes_combined, 0); } return OK; |
