From: Jeff Trawick Date: Sat, 26 Feb 2011 15:32:01 +0000 (+0000) Subject: fix some logging calls to include the server_rec X-Git-Tag: 2.3.11~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=46bdc28bf4c492a6596ca6245f61d20dd776ed9a;p=thirdparty%2Fapache%2Fhttpd.git fix some logging calls to include the server_rec (and even the conn_rec in a couple of places) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1074871 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/experimental/mod_noloris.c b/modules/experimental/mod_noloris.c index 53adbebe1f7..f2c423cf3d6 100644 --- a/modules/experimental/mod_noloris.c +++ b/modules/experimental/mod_noloris.c @@ -148,7 +148,7 @@ static int noloris_monitor(apr_pool_t *pool, server_rec *s) if (*n >= default_max_connections) { /* if this isn't a trusted proxy, we mark it as bad */ if (!apr_hash_get(trusted, ip, APR_HASH_KEY_STRING)) { - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, 0, + ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, "noloris: banning %s with %d connections in READ state", ip, *n); strcpy(shm_rec, ip); diff --git a/modules/generators/mod_cgid.c b/modules/generators/mod_cgid.c index 810a49b3ff5..7b6a17c48e5 100644 --- a/modules/generators/mod_cgid.c +++ b/modules/generators/mod_cgid.c @@ -285,11 +285,11 @@ static void cgid_maint(int reason, void *data, apr_wait_t status) } if (!stopping) { if (status == DAEMON_STARTUP_ERROR) { - ap_log_error(APLOG_MARK, APLOG_CRIT, 0, NULL, + ap_log_error(APLOG_MARK, APLOG_CRIT, 0, ap_server_conf, "cgid daemon failed to initialize"); } else { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, + ap_log_error(APLOG_MARK, APLOG_ERR, 0, ap_server_conf, "cgid daemon process died, restarting"); cgid_start(root_pool, root_server, proc); } @@ -314,7 +314,7 @@ static void cgid_maint(int reason, void *data, apr_wait_t status) * guarantee the same permissions as when the socket was created. */ if (unlink(sockname) < 0 && errno != ENOENT) { - ap_log_error(APLOG_MARK, APLOG_ERR, errno, NULL, + ap_log_error(APLOG_MARK, APLOG_ERR, errno, ap_server_conf, "Couldn't unlink unix domain socket %s", sockname); } diff --git a/os/bs2000/os.c b/os/bs2000/os.c index d75ecb385fc..d0f21645947 100644 --- a/os/bs2000/os.c +++ b/os/bs2000/os.c @@ -124,7 +124,7 @@ pid_t os_fork(const char *user) pid = ufork(username); if (pid == -1 && errno == EPERM) { ap_log_error(APLOG_MARK, APLOG_EMERG, errno, - NULL, "ufork: Possible mis-configuration " + ap_server_conf, "ufork: Possible mis-configuration " "for user %s - Aborting.", user); exit(1); } diff --git a/os/unix/unixd.c b/os/unix/unixd.c index e8677d13831..db5d328e477 100644 --- a/os/unix/unixd.c +++ b/os/unix/unixd.c @@ -307,7 +307,7 @@ AP_DECLARE(apr_status_t) ap_unixd_accept(void **accepted, ap_listen_rec *lr, #ifdef _OSD_POSIX apr_os_sock_get(&sockdes, csd); if (sockdes >= FD_SETSIZE) { - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, + ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ap_server_conf, "new file descriptor %d is too large; you probably need " "to rebuild Apache with a larger FD_SETSIZE " "(currently %d)", @@ -535,7 +535,7 @@ pid_t os_fork(const char *user) pid = ufork(username); if (pid == -1 && errno == EPERM) { ap_log_error(APLOG_MARK, APLOG_EMERG, errno, - NULL, "ufork: Possible mis-configuration " + ap_server_conf, "ufork: Possible mis-configuration " "for user %s - Aborting.", user); exit(1); } diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index ece2b8f78ad..251b2678204 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -201,11 +201,11 @@ static void accept_mutex_on(void) if (my_generation != ap_scoreboard_image->global->running_generation) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, NULL, "%s", msg); + ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, ap_server_conf, "%s", msg); clean_child_exit(0); } else { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, NULL, "%s", msg); + ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf, "%s", msg); exit(APEXIT_CHILDFATAL); } } @@ -219,14 +219,14 @@ static void accept_mutex_off(void) if (my_generation != ap_scoreboard_image->global->running_generation) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, NULL, "%s", msg); + ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, ap_server_conf, "%s", msg); /* don't exit here... we have a connection to * process, after which point we'll see that the * generation changed and we'll exit cleanly */ } else { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, NULL, "%s", msg); + ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf, "%s", msg); exit(APEXIT_CHILDFATAL); } } diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c index cb7c22c9049..19463991a21 100644 --- a/server/mpm/winnt/mpm_winnt.c +++ b/server/mpm/winnt/mpm_winnt.c @@ -323,7 +323,7 @@ void get_handles_from_parent(server_rec *s, HANDLE *child_exit_event, rv = ap_reopen_scoreboard(s->process->pool, scoreboard_shm, 1); if (rv || !(sb_shared = apr_shm_baseaddr_get(*scoreboard_shm))) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf, "Child %d: Unable to reopen the scoreboard from the parent", my_pid); exit(APEXIT_CHILDINIT); } diff --git a/server/scoreboard.c b/server/scoreboard.c index 5f6dfb8c3a5..8588dc6ca55 100644 --- a/server/scoreboard.c +++ b/server/scoreboard.c @@ -180,7 +180,7 @@ static apr_status_t create_namebased_scoreboard(apr_pool_t *pool, rv = apr_shm_create(&ap_scoreboard_shm, scoreboard_size, fname, pool); if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf, "unable to create or access scoreboard \"%s\" " "(name-based shared memory failure)", fname); return rv; @@ -205,7 +205,7 @@ static apr_status_t open_scoreboard(apr_pool_t *pconf) */ rv = apr_pool_create(&global_pool, NULL); if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf, "Fatal error: unable to create global pool " "for use by the scoreboard"); return rv; @@ -216,7 +216,7 @@ static apr_status_t open_scoreboard(apr_pool_t *pconf) /* make sure it's an absolute pathname */ fname = ap_server_root_relative(pconf, ap_scoreboard_fname); if (!fname) { - ap_log_error(APLOG_MARK, APLOG_CRIT, APR_EBADPATH, NULL, + ap_log_error(APLOG_MARK, APLOG_CRIT, APR_EBADPATH, ap_server_conf, "Fatal error: Invalid Scoreboard path %s", ap_scoreboard_fname); return APR_EBADPATH; @@ -227,7 +227,7 @@ static apr_status_t open_scoreboard(apr_pool_t *pconf) rv = apr_shm_create(&ap_scoreboard_shm, scoreboard_size, NULL, global_pool); /* anonymous shared memory */ if ((rv != APR_SUCCESS) && (rv != APR_ENOTIMPL)) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf, "Unable to create or access scoreboard " "(anonymous shared memory failure)"); return rv; @@ -255,7 +255,7 @@ apr_status_t ap_reopen_scoreboard(apr_pool_t *p, apr_shm_t **shm, int detached) return APR_SUCCESS; } if (apr_shm_size_get(ap_scoreboard_shm) < scoreboard_size) { - ap_log_error(APLOG_MARK, APLOG_CRIT, 0, NULL, + ap_log_error(APLOG_MARK, APLOG_CRIT, 0, ap_server_conf, "Fatal error: shared scoreboard too small for child!"); apr_shm_detach(ap_scoreboard_shm); ap_scoreboard_shm = NULL; @@ -325,7 +325,7 @@ int ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e sb_type) /* A simple malloc will suffice */ void *sb_mem = calloc(1, scoreboard_size); if (sb_mem == NULL) { - ap_log_error(APLOG_MARK, APLOG_CRIT, 0, NULL, + ap_log_error(APLOG_MARK, APLOG_CRIT, 0, ap_server_conf, "(%d)%s: cannot allocate scoreboard", errno, strerror(errno)); return HTTP_INTERNAL_SERVER_ERROR; diff --git a/server/util_filter.c b/server/util_filter.c index 6b9a8d5cbfb..94095a243c7 100644 --- a/server/util_filter.c +++ b/server/util_filter.c @@ -291,8 +291,8 @@ static ap_filter_t *add_any_filter_handle(ap_filter_rec_t *frec, void *ctx, outf = r_filters; } else { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, - "a content filter was added without a request: %s", frec->name); + ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, + "a content filter was added without a request: %s", frec->name); return NULL; } } @@ -301,8 +301,8 @@ static ap_filter_t *add_any_filter_handle(ap_filter_rec_t *frec, void *ctx, outf = p_filters; } else { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, - "a protocol filter was added without a request: %s", frec->name); + ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, + "a protocol filter was added without a request: %s", frec->name); return NULL; } } @@ -398,8 +398,8 @@ static ap_filter_t *add_any_filter(const char *name, void *ctx, } } - ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, - "an unknown filter was not added: %s", name); + ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, r ? r->connection : c, + "an unknown filter was not added: %s", name); return NULL; }