summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/core.c10
-rw-r--r--server/log.c28
2 files changed, 28 insertions, 10 deletions
diff --git a/server/core.c b/server/core.c
index 1fe2cce3c5..df61a38afd 100644
--- a/server/core.c
+++ b/server/core.c
@@ -4261,9 +4261,9 @@ static apr_status_t core_output_filter(ap_filter_t *f, apr_bucket_brigade *b)
rv = apr_bucket_read(bucket, &buf, &len,
APR_BLOCK_READ);
if (rv != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_ERR, rv,
- c->base_server, "core_output_filter:"
- " Error reading from bucket.");
+ ap_log_cerror(APLOG_MARK, APLOG_ERR, rv,
+ c, "core_output_filter:"
+ " Error reading from bucket.");
return HTTP_INTERNAL_SERVER_ERROR;
}
}
@@ -4367,8 +4367,8 @@ static apr_status_t core_output_filter(ap_filter_t *f, apr_bucket_brigade *b)
}
if (rv != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_INFO, rv, c->base_server,
- "core_output_filter: writing data to the network");
+ ap_log_cerror(APLOG_MARK, APLOG_INFO, rv, c,
+ "core_output_filter: writing data to the network");
if (more)
apr_brigade_destroy(more);
diff --git a/server/log.c b/server/log.c
index 4324944f9b..423fae7135 100644
--- a/server/log.c
+++ b/server/log.c
@@ -358,6 +358,7 @@ AP_DECLARE(void) ap_error_log2stderr(server_rec *s) {
static void log_error_core(const char *file, int line, int level,
apr_status_t status, const server_rec *s,
+ const conn_rec *c,
const request_rec *r, apr_pool_t *pool,
const char *fmt, va_list args)
{
@@ -370,6 +371,10 @@ static void log_error_core(const char *file, int line, int level,
const char *referer;
int level_and_mask = level & APLOG_LEVELMASK;
+ if (r && r->connection) {
+ c = r->connection;
+ }
+
if (s == NULL) {
/*
* If we are doing stderr logging (startup), don't log messages that are
@@ -472,14 +477,14 @@ static void log_error_core(const char *file, int line, int level,
}
#endif /* TPF */
- if (r && r->connection) {
+ if (c) {
/* XXX: TODO: add a method of selecting whether logged client
* addresses are in dotted quad or resolved form... dotted
* quad is the most secure, which is why I'm implementing it
* first. -djg
*/
len += apr_snprintf(errstr + len, MAX_STRING_LEN - len,
- "[client %s] ", r->connection->remote_ip);
+ "[client %s] ", c->remote_ip);
}
if (status != 0) {
if (status < APR_OS_START_EAIERR) {
@@ -558,7 +563,7 @@ AP_DECLARE(void) ap_log_error(const char *file, int line, int level,
va_list args;
va_start(args, fmt);
- log_error_core(file, line, level, status, s, NULL, NULL, fmt, args);
+ log_error_core(file, line, level, status, s, NULL, NULL, NULL, fmt, args);
va_end(args);
}
@@ -569,7 +574,7 @@ AP_DECLARE(void) ap_log_perror(const char *file, int line, int level,
va_list args;
va_start(args, fmt);
- log_error_core(file, line, level, status, NULL, NULL, p, fmt, args);
+ log_error_core(file, line, level, status, NULL, NULL, NULL, p, fmt, args);
va_end(args);
}
@@ -580,7 +585,8 @@ AP_DECLARE(void) ap_log_rerror(const char *file, int line, int level,
va_list args;
va_start(args, fmt);
- log_error_core(file, line, level, status, r->server, r, NULL, fmt, args);
+ log_error_core(file, line, level, status, r->server, NULL, r, NULL, fmt,
+ args);
/*
* IF APLOG_TOCLIENT is set,
@@ -601,6 +607,18 @@ AP_DECLARE(void) ap_log_rerror(const char *file, int line, int level,
va_end(args);
}
+AP_DECLARE(void) ap_log_cerror(const char *file, int line, int level,
+ apr_status_t status, const conn_rec *c,
+ const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ log_error_core(file, line, level, status, c->base_server, c, NULL, NULL,
+ fmt, args);
+ va_end(args);
+}
+
AP_DECLARE(void) ap_log_pid(apr_pool_t *p, const char *filename)
{
apr_file_t *pid_file = NULL;