From 8ae0035a867fe27e3ac3b0aae4462324e111987c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Tue, 10 Oct 2023 09:33:11 +0200 Subject: [PATCH] Tweak log messages --- native/advertise/mod_advertise.c | 15 +- native/balancers/mod_lbmethod_cluster.c | 9 +- native/mod_manager/mod_manager.c | 81 +++++---- native/mod_proxy_cluster/mod_proxy_cluster.c | 175 ++++++++++--------- 4 files changed, 152 insertions(+), 128 deletions(-) diff --git a/native/advertise/mod_advertise.c b/native/advertise/mod_advertise.c index 3f9abd2eb..417bac277 100644 --- a/native/advertise/mod_advertise.c +++ b/native/advertise/mod_advertise.c @@ -581,8 +581,8 @@ static int post_config_hook(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *pte if (ppid) { ma_parent_pid = atol(ppid); ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, - "[%" APR_PID_T_FMT " - %" APR_PID_T_FMT "] in child post config hook", getpid(), - ma_parent_pid); + "post_config_hook: [%" APR_PID_T_FMT " - %" APR_PID_T_FMT "] in child post config hook", + getpid(), ma_parent_pid); return OK; } } @@ -608,7 +608,7 @@ static int post_config_hook(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *pte rv = ma_group_join(mconf->ma_advertise_adrs, mconf->ma_advertise_port, mconf->ma_bind_adrs, mconf->ma_bind_port, pconf, s); if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s, "mod_advertise: multicast join failed for %s:%d.", + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s, "post_config_hook: multicast join failed for %s:%d.", mconf->ma_advertise_adrs, mconf->ma_advertise_port); ma_advertise_run = 0; } else { @@ -651,7 +651,7 @@ static int post_config_hook(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *pte rv = apr_parse_addr_port(&mconf->ma_advertise_srvs, &mconf->ma_advertise_srvi, &mconf->ma_advertise_srvp, ptr, pproc); if (rv != APR_SUCCESS || !mconf->ma_advertise_srvs || !mconf->ma_advertise_srvp) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s, "mod_advertise: Invalid ServerAdvertise Address %s", ptr); + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s, "post_config_hook: Invalid ServerAdvertise Address %s", ptr); return rv; } } @@ -659,7 +659,7 @@ static int post_config_hook(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *pte /* prevent X-Manager-Address: (null):0 */ if (!mconf->ma_advertise_srvs || !mconf->ma_advertise_srvp) { ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, - "mod_advertise: ServerAdvertise Address or Port not defined, Advertise disabled!!!"); + "post_config_hook: ServerAdvertise Address or Port not defined, Advertise disabled!!!"); return OK; } @@ -667,7 +667,7 @@ static int post_config_hook(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *pte is_mp_running = 1; rv = apr_thread_create(&tp, NULL, parent_thread, server, pconf); if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s, "mod_advertise: parent apr_thread_create"); + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s, "post_config_hook: parent apr_thread_create"); return rv; } apr_thread_detach(tp); @@ -678,7 +678,8 @@ static int post_config_hook(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *pte apr_pool_create(&magd->cpool, pconf); apr_pool_cleanup_register(magd->cpool, magd, pconfig_cleanup, apr_pool_cleanup_null); - ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, "Advertise initialized for process %" APR_PID_T_FMT, getpid()); + ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, "post_config_hook: Advertise initialized for process %" APR_PID_T_FMT, + getpid()); apr_pool_cleanup_register(magd->ppool, magd, process_cleanup, apr_pool_cleanup_null); diff --git a/native/balancers/mod_lbmethod_cluster.c b/native/balancers/mod_lbmethod_cluster.c index 20b262b56..1550fdd5c 100644 --- a/native/balancers/mod_lbmethod_cluster.c +++ b/native/balancers/mod_lbmethod_cluster.c @@ -395,17 +395,20 @@ static int lbmethod_cluster_post_config(apr_pool_t *p, apr_pool_t *plog, apr_poo mc_watchdog_get_instance = APR_RETRIEVE_OPTIONAL_FN(ap_watchdog_get_instance); mc_watchdog_register_callback = APR_RETRIEVE_OPTIONAL_FN(ap_watchdog_register_callback); if (!mc_watchdog_get_instance || !mc_watchdog_register_callback) { - ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(03262) "mod_watchdog is required"); + ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, + APLOGNO(03262) "proxy_cluster_post_config: mod_watchdog is required"); return !OK; } if (mc_watchdog_get_instance(&watchdog, LB_CLUSTER_WATHCHDOG_NAME, 0, 1, p)) { - ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(03263) "Failed to create watchdog instance (%s)", + ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, + APLOGNO(03263) "proxy_cluster_post_config: Failed to create watchdog instance (%s)", LB_CLUSTER_WATHCHDOG_NAME); return !OK; } while (s) { if (mc_watchdog_register_callback(watchdog, AP_WD_TM_SLICE, s, mc_watchdog_callback)) { - ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(03264) "Failed to register watchdog callback (%s)", + ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, + APLOGNO(03264) "proxy_cluster_post_config: Failed to register watchdog callback (%s)", LB_CLUSTER_WATHCHDOG_NAME); return !OK; } diff --git a/native/mod_manager/mod_manager.c b/native/mod_manager/mod_manager.c index dad633fd4..8956d971d 100644 --- a/native/mod_manager/mod_manager.c +++ b/native/mod_manager/mod_manager.c @@ -616,28 +616,31 @@ static int manager_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, serv /* Do some sanity checks */ if (mconf->maxhost < mconf->maxnode) { - ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, "Maxhost value increased to Maxnode (%d)", mconf->maxnode); + ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, "manager_init: Maxhost value increased to Maxnode (%d)", + mconf->maxnode); mconf->maxhost = mconf->maxnode; } if (mconf->maxcontext < mconf->maxhost) { - ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, "Maxcontext value increased to Maxhost (%d)", mconf->maxhost); + ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, "manager_init: Maxcontext value increased to Maxhost (%d)", + mconf->maxhost); mconf->maxcontext = mconf->maxhost; } /* Get a provider to handle the shared memory */ storage = ap_lookup_provider(AP_SLOTMEM_PROVIDER_GROUP, "shm", AP_SLOTMEM_PROVIDER_VERSION); if (storage == NULL) { - ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "ap_lookup_provider %s failed", AP_SLOTMEM_PROVIDER_GROUP); + ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "manager_init: ap_lookup_provider %s failed", + AP_SLOTMEM_PROVIDER_GROUP); return !OK; } nodestatsmem = create_mem_node(node, &mconf->maxnode, mconf->persistent + AP_SLOTMEM_TYPE_PREGRAB, p, storage); if (nodestatsmem == NULL) { - ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "create_mem_node %s failed", node); + ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "manager_init: create_mem_node %s failed", node); return !OK; } if (get_last_mem_error(nodestatsmem) != APR_SUCCESS) { char buf[120]; - ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "create_mem_node %s failed: %s", node, + ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "manager_init: create_mem_node %s failed: %s", node, apr_strerror(get_last_mem_error(nodestatsmem), buf, sizeof(buf))); return !OK; } @@ -645,20 +648,20 @@ static int manager_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, serv contextstatsmem = create_mem_context(context, &mconf->maxcontext, mconf->persistent + AP_SLOTMEM_TYPE_PREGRAB, p, storage); if (contextstatsmem == NULL) { - ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "create_mem_context failed"); + ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "manager_init: create_mem_context failed"); return !OK; } hoststatsmem = create_mem_host(host, &mconf->maxhost, mconf->persistent + AP_SLOTMEM_TYPE_PREGRAB, p, storage); if (hoststatsmem == NULL) { - ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "create_mem_host failed"); + ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "manager_init: create_mem_host failed"); return !OK; } balancerstatsmem = create_mem_balancer(balancer, &mconf->maxhost, mconf->persistent + AP_SLOTMEM_TYPE_PREGRAB, p, storage); if (balancerstatsmem == NULL) { - ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "create_mem_balancer failed"); + ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "manager_init: create_mem_balancer failed"); return !OK; } @@ -667,7 +670,7 @@ static int manager_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, serv sessionidstatsmem = create_mem_sessionid(sessionid, &mconf->maxsessionid, mconf->persistent + AP_SLOTMEM_TYPE_PREGRAB, p, storage); if (sessionidstatsmem == NULL) { - ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "create_mem_sessionid failed"); + ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "manager_init: create_mem_sessionid failed"); return !OK; } } @@ -675,7 +678,7 @@ static int manager_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, serv domainstatsmem = create_mem_domain(domain, &mconf->maxnode, mconf->persistent + AP_SLOTMEM_TYPE_PREGRAB, p, storage); if (domainstatsmem == NULL) { - ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "create_mem_domain failed"); + ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "manager_init: create_mem_domain failed"); return !OK; } @@ -693,7 +696,7 @@ static int manager_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, serv } } if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "create_share_version failed"); + ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "manager_init: create_share_version failed"); return !OK; } base = (version_data *)apr_shm_baseaddr_get(versionipc_shm); @@ -702,7 +705,7 @@ static int manager_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, serv /* Get a provider to ping/pong logics */ balancerhandler = ap_lookup_provider("proxy_cluster", "balancer", "0"); if (balancerhandler == NULL) { - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, "can't find a ping/pong logic"); + ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, "manager_init: can't find a ping/pong logic"); } advertise_info = ap_lookup_provider("advertise", "info", "0"); @@ -922,7 +925,7 @@ static int is_same_worker_existing(const request_rec *r, const nodeinfo_t *node) } } ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server, - "process_config: nodes %s and %s correspond to the same worker!", node->mess.JVMRoute, + "process_config: nodes %s and %s correspond to the same worker", node->mess.JVMRoute, ou->mess.JVMRoute); return -1; } @@ -1233,6 +1236,7 @@ static char *process_config(request_rec *r, char **ptr, int *errtype) /* Fill default node values */ process_config_node_defaults(r, &nodeinfo, mconf); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "process_config: Start"); /* Fill default balancer values */ process_config_balancer_defaults(r, &balancerinfo, mconf); @@ -1326,7 +1330,7 @@ static char *process_config(request_rec *r, char **ptr, int *errtype) /* Here we can't update it because the old one is still in */ char *mess = apr_psprintf(r->pool, MNODERM, node->mess.JVMRoute); ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "process_config: node %s %d %s : %s %s already exist removing...", node->mess.JVMRoute, + "process_config: node %s %d %s : %s %s already exists, removing...", node->mess.JVMRoute, node->mess.id, node->mess.Port, nodeinfo.mess.JVMRoute, nodeinfo.mess.Port); strcpy(node->mess.JVMRoute, "REMOVED"); node->mess.remove = 1; @@ -1352,15 +1356,14 @@ static char *process_config(request_rec *r, char **ptr, int *errtype) /* Same node should be OK, different nodes will bring problems */ if (node != NULL && node->mess.id == id) { ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "process_config: proxy_node_getid() worker exist and should be OK"); + "process_config: worker %d (%s) exists and should be OK", id, nodeinfo.mess.JVMRoute); } else { /* Here that is the tricky part, we will insert_update the whole node including proxy_worker_shared */ char *pptr; unsigned long offset; ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server, - "process_config: proxy_node_getid() worker %d (%s) exists and IS NOT OK!!!", id, - nodeinfo.mess.JVMRoute); + "process_config: worker %d (%s) exists and IS NOT OK!!!", id, nodeinfo.mess.JVMRoute); if (node == NULL) { /* try to read the node */ nodeinfo_t workernodeinfo; @@ -1376,7 +1379,7 @@ static char *process_config(request_rec *r, char **ptr, int *errtype) } else if ((workernode->mess.JVMRoute[0] != '\0') && (strcmp(workernode->mess.JVMRoute, nodeinfo.mess.JVMRoute) != 0)) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "process_config: proxy_node_getid() worker %d (%s) exists and IS NOT %s!!!", id, + "process_config: worker %d (%s) exists and does NOT correspond to %s", id, workernode->mess.JVMRoute, nodeinfo.mess.JVMRoute); loc_unlock_nodes(); *errtype = TYPEMEM; @@ -1450,8 +1453,8 @@ static char *process_config(request_rec *r, char **ptr, int *errtype) workernode = read_node(nodestatsmem, &workernodeinfo); ap_assert(workernode != NULL); ap_assert(the_conf); - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "process_config: proxy_node_getid() worker %s inserted... %d", nodeinfo.mess.JVMRoute, id); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "process_config: worker %d (%s) inserted", id, + nodeinfo.mess.JVMRoute); /* make sure we can use it */ ap_assert(worker->context != NULL); ap_assert(workernode->mess.id == id); @@ -1494,7 +1497,6 @@ static char *process_config(request_rec *r, char **ptr, int *errtype) phost = phost->next; vid++; } - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "process_config: DONE!!!"); loc_unlock_nodes(); /* if using mod_balancer create or update the worker */ @@ -1505,6 +1507,8 @@ static char *process_config(request_rec *r, char **ptr, int *errtype) ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "process_config: NO balancer-manager"); } + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "process_config: Done"); + return NULL; } @@ -1910,8 +1914,8 @@ static char *process_node_cmd(request_rec *r, int status, int *errtype, nodeinfo int *id; (void)errtype; - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "process_node_cmd %d processing node: %d", status, - node->mess.id); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "process_node_cmd: status %s processing node: %d", + context_status_to_string(status), node->mess.id); if (size == 0) { return NULL; } @@ -2143,8 +2147,9 @@ static char *process_appl_cmd(request_rec *r, char **ptr, int status, int *errty } if (strcmp(hisnode->mess.balancer, node->mess.balancer)) { /* the same context would be on 2 different balancer */ - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server, "ENABLE: context %s is in balancer %s and %s", - vhost->context, node->mess.balancer, hisnode->mess.balancer); + ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server, + "process_appl_cmd: ENABLE: context %s is in balancer %s and %s", vhost->context, + node->mess.balancer, hisnode->mess.balancer); } } } @@ -2565,7 +2570,7 @@ static int manager_trans(request_rec *r) if (ours) { int i; /* The method one of ours */ - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "manager_trans %s (%s)", r->method, r->uri); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "manager_trans: %s (%s)", r->method, r->uri); r->handler = "mod-cluster"; /* that hack doesn't work on httpd-2.4.x */ i = strlen(r->uri); if (strcmp(r->uri, "*") == 0 || (i >= 2 && r->uri[i - 1] == '*' && r->uri[i - 2] == '/')) { @@ -2594,7 +2599,7 @@ static int manager_map_to_storage(request_rec *r) ours = check_method(r); if (ours) { /* The method one of ours */ - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "manager_map_to_storage %s (%s)", r->method, r->uri); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "manager_map_to_storage: %s (%s)", r->method, r->uri); return OK; } @@ -2922,7 +2927,7 @@ static char *process_domain(request_rec *r, char **ptr, int *errtype, const char ptr[pos] = apr_pstrdup(r->pool, "JVMRoute"); ptr[pos + 2] = NULL; ptr[pos + 3] = NULL; - ap_log_error(APLOG_MARK, APLOG_EMERG, 0, r->server, "process_domain"); + ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "process_domain"); for (i = 0; i < size; i++) { nodeinfo_t *ou; if (get_node(nodestatsmem, &ou, id[i]) != APR_SUCCESS) { @@ -3033,7 +3038,7 @@ static int manager_info(request_rec *r) return HTTP_BAD_REQUEST; } } - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "manager_info request:%s", r->args); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "manager_info: request: %s", r->args); } /* @@ -3318,13 +3323,13 @@ static int manager_handler(request_rec *r) apr_table_setn(r->err_headers_out, "Version", VERSION_PROTOCOL); apr_table_setn(r->err_headers_out, "Type", "SYNTAX"); apr_table_setn(r->err_headers_out, "Mess", errstring); - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "manager_handler %s error: %s", r->method, errstring); + ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "manager_handler: %s error: %s", r->method, errstring); return 500; } buff[bufsiz] = '\0'; /* XXX: Size limit it? */ - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "manager_handler %s (%s) processing: \"%s\"", r->method, + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "manager_handler: %s (%s) processing: \"%s\"", r->method, r->filename, buff); ptr = process_buff(r, buff); @@ -3371,7 +3376,7 @@ static int manager_handler(request_rec *r) return 500; } - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "manager_handler %s OK", r->method); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "manager_handler: %s OK", r->method); ap_rflush(r); return OK; @@ -3424,31 +3429,31 @@ static void manager_child_init(apr_pool_t *p, server_rec *s) nodestatsmem = get_mem_node(node, &mconf->maxnode, p, storage); if (nodestatsmem == NULL) { - ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "get_mem_node %s failed", node); + ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "manager_child_init: get_mem_node %s failed", node); return; } if (get_last_mem_error(nodestatsmem) != APR_SUCCESS) { char buf[120]; - ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "get_mem_node %s failed: %s", node, + ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "manager_child_init: get_mem_node %s failed: %s", node, apr_strerror(get_last_mem_error(nodestatsmem), buf, sizeof(buf))); return; } contextstatsmem = get_mem_context(context, &mconf->maxcontext, p, storage); if (contextstatsmem == NULL) { - ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "get_mem_context failed"); + ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "manager_child_init: get_mem_context failed"); return; } hoststatsmem = get_mem_host(host, &mconf->maxhost, p, storage); if (hoststatsmem == NULL) { - ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "get_mem_host failed"); + ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "manager_child_init: get_mem_host failed"); return; } balancerstatsmem = get_mem_balancer(balancer, &mconf->maxhost, p, storage); if (balancerstatsmem == NULL) { - ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "get_mem_balancer failed"); + ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "manager_child_init: get_mem_balancer failed"); return; } @@ -3456,7 +3461,7 @@ static void manager_child_init(apr_pool_t *p, server_rec *s) /* Try to get sessionid stuff only if required */ sessionidstatsmem = get_mem_sessionid(sessionid, &mconf->maxsessionid, p, storage); if (sessionidstatsmem == NULL) { - ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "get_mem_sessionid failed"); + ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "manager_child_init: get_mem_sessionid failed"); return; } } diff --git a/native/mod_proxy_cluster/mod_proxy_cluster.c b/native/mod_proxy_cluster/mod_proxy_cluster.c index 147f621df..8171af822 100644 --- a/native/mod_proxy_cluster/mod_proxy_cluster.c +++ b/native/mod_proxy_cluster/mod_proxy_cluster.c @@ -256,14 +256,14 @@ static void check_workers(const proxy_server_conf *conf, const server_rec *s) /* this happens when a new child process is created and it "cleaned" some old slotmem */ /* it is like the remove_workers_node we try to restore the non shared memory allocated in * create_worker() */ - ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, "check_workers DOING (empty port : %d id : %d!!!!", + ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, "check_workers: DOING (empty port : %d id : %d", helper->shared->port, helper->index); stop_worker = 1; } if (worker->s->port != helper->shared->port || strcmp(worker->s->scheme, helper->shared->scheme) || strcmp(worker->s->hostname, helper->shared->hostname)) { /* here the shared memory has changed since we created the worker */ - ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, "check_workers DOING (changed %d : %d)!!!!", + ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, "check_workers: DOING (changed %d : %d)", helper->shared->port, worker->s->port); stop_worker = 1; } @@ -294,17 +294,17 @@ static apr_status_t create_worker_reuse(proxy_server_conf *conf, const char *ptr proxy_cluster_helper *helper; const char *ptr; - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Created: worker for %s Already exist!!!", url); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "create_worker: worker for %s already exists", url); if (!worker->context) { /* That is BalancerMember, we dropped support of it */ - ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Created: reusing BalancerMember worker for %s", url); + ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "create_worker: reusing BalancerMember worker for %s", url); return APR_EGENERAL; } *helper_ptr = (proxy_cluster_helper *)worker->context; helper = *helper_ptr; if (helper->index == -1) { /* We are going to reuse a removed one */ - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Created: reusing removed worker for %s", url); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "create_worker: reusing removed worker for %s", url); ap_assert(0); return APR_SUCCESS; } @@ -359,7 +359,8 @@ static apr_status_t create_worker_reuse(proxy_server_conf *conf, const char *ptr helper->index = node->mess.id; if ((rv = ap_proxy_initialize_worker(worker, server, conf->pool)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, server, "ap_proxy_initialize_worker failed %d for %s", rv, url); + ap_log_error(APLOG_MARK, APLOG_ERR, rv, server, "create_worker: ap_proxy_initialize_worker failed %d for %s", + rv, url); return rv; } @@ -535,7 +536,8 @@ static apr_status_t create_worker(proxy_server_conf *conf, proxy_balancer *balan } if ((rv = ap_proxy_initialize_worker(worker, server, conf->pool)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, server, "ap_proxy_initialize_worker failed %d for %s:%s", rv, url, ptr); + ap_log_error(APLOG_MARK, APLOG_ERR, rv, server, "create_worker: ap_proxy_initialize_worker failed %d for %s:%s", + rv, url, ptr); return rv; } worker->s->index = node->mess.id; @@ -833,9 +835,9 @@ static int remove_workers_node(nodeinfo_t *node, proxy_server_conf *conf, apr_po if (helper) { i = helper->count_active; } else { - ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, server, "remove_workers_node (helper is NULL)"); + ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, server, "remove_workers_node: helper is NULL"); } - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "remove_workers_node (helper) count_active: %d JVMRoute: %s", i, + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "remove_workers_node: helper count_active: %d JVMRoute: %s", i, node->mess.JVMRoute); if (i == 0) { @@ -846,11 +848,11 @@ static int remove_workers_node(nodeinfo_t *node, proxy_server_conf *conf, apr_po worker->s = helper->shared; helper->isinnodes = 0; ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, server, - "remove_workers_node... scheme %s hostname %s port %d route %s name (%s):(%s) id (%d:%d)", + "remove_workers_node: scheme %s hostname %s port %d route %s name (%s):(%s) id (%d:%d)", stat->scheme, stat->hostname_ex, stat->port, stat->route, stat->name, helper->shared->name, stat->index, helper->index); ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, server, - "remove_workers_node... restored: scheme %s hostname %s port %d route %s name %s id:%d", + "remove_workers_node: restored: scheme %s hostname %s port %d route %s name %s id:%d", worker->s->scheme, worker->s->hostname_ex, worker->s->port, worker->s->route, worker->s->name, worker->s->index); /* XXX : look bad with new logic!!!! memcpy(worker->s, stat, sizeof(proxy_worker_shared)); */ @@ -895,7 +897,7 @@ static void update_workers_node(const proxy_server_conf *conf, apr_pool_t *pool, /* XXX: How to skip the balancer that aren't controled by mod_manager */ - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "update_workers_node starting"); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "update_workers_node: Starting"); /* Only process the nodes that have been updated since our last update */ for (i = 0; i < node_table->sizenode; i++) { @@ -909,7 +911,7 @@ static void update_workers_node(const proxy_server_conf *conf, apr_pool_t *pool, add_balancers_workers_for_server(ou, node_table->ptr_node[i], pool, server); } - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "update_workers_node done"); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "update_workers_node: Done"); } /* @@ -934,12 +936,12 @@ static apr_status_t ajp_handle_cping_cpong(apr_socket_t *sock, const request_rec status = apr_socket_send(sock, buf, &written); if (status != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, "ajp_cping_cpong(): send failed"); + ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, "ajp_cping_cpong: send failed"); return status; } status = apr_socket_timeout_get(sock, &org); if (status != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, "ajp_cping_cpong(): apr_socket_timeout_get failed"); + ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, "ajp_cping_cpong: apr_socket_timeout_get failed"); return status; } status = apr_socket_timeout_set(sock, timeout); @@ -1049,14 +1051,14 @@ static apr_status_t http_handle_cping_cpong(proxy_conn_rec *p_conn, request_rec status = ap_pass_brigade(p_conn->connection->output_filters, header_brigade); apr_brigade_cleanup(header_brigade); if (status != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, "http_cping_cpong(): send failed"); + ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, "http_cping_cpong: send failed"); p_conn->close = 1; return status; } status = apr_socket_timeout_get(p_conn->sock, &org); if (status != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, "http_cping_cpong(): apr_socket_timeout_get failed"); + ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, "http_cping_cpong: apr_socket_timeout_get failed"); p_conn->close = 1; return status; } @@ -1319,7 +1321,7 @@ static int internal_update_lbstatus(proxy_server_conf *conf, apr_pool_t *pool, s /* Here we should decide about using hcheck result or a request that pings the node */ if (proxyhctemplate != NULL) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "update_workers_lbstatus Using hcheck!"); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "update_workers_lbstatus: Using hcheck!"); if (worker->s->status & PROXY_WORKER_NOT_USABLE_BITMAP) { /* marked errored by hcheck */ ou->mess.num_failure_idle++; @@ -1335,7 +1337,7 @@ static int internal_update_lbstatus(proxy_server_conf *conf, apr_pool_t *pool, s return 1; /* Done in this case */ } - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "update_workers_lbstatus Using old logic!"); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "update_workers_lbstatus: Using old logic!"); node_storage->unlock_nodes(); /* We are going to check the worker... check if we are told to stop */ @@ -1367,9 +1369,11 @@ static int internal_update_lbstatus(proxy_server_conf *conf, apr_pool_t *pool, s return 0; } /* Log about failed scheduling and execute without threads below. */ - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "thread push was NOT successful: %d", res); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, + "update_workers_lbstatus: thread push was NOT successful: %d", res); } else { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Memory allocation for thread args failed"); + ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, + "update_workers_lbstatus: Memory allocation for thread args failed"); } /* Thread alloc or push failed, so run it without threads! * That means the execution continues after the endif below! @@ -1563,17 +1567,20 @@ static proxy_worker *internal_process_worker(proxy_worker *worker, int checking_ proxy_cluster_helper *helper = (proxy_cluster_helper *)worker->context; if (!worker->s || !worker->context) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "proxy: byrequests balancer %s skipping BAD worker %s", - balancer_name, worker->s ? worker->s->name_ex : "NULL"); + ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + "find_session_route: byrequests balancer %s skipping BAD worker %s", balancer_name, + worker->s ? worker->s->name_ex : "NULL"); return NULL; } if (helper->index == -1) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "proxy: byrequests balancer skipping REMOVED worker"); + ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + "find_session_route: byrequests balancer skipping REMOVED worker"); return NULL; /* marked removed */ } if (helper->index != worker->s->index) { /* something is very bad */ - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "proxy: byrequests balancer skipping BAD worker"); + ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + "find_session_route: byrequests balancer skipping BAD worker"); return NULL; /* probably used by different worker */ } @@ -1597,7 +1604,7 @@ static proxy_worker *internal_process_worker(proxy_worker *worker, int checking_ */ if (best == NULL) { apr_table_setn(r->subprocess_env, "BALANCER_CONTEXT_ID", ""); - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "proxy: byrequests balancer FAILED"); + ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "find_session_route: byrequests balancer FAILED"); return NULL; } best1 = best; @@ -1684,7 +1691,8 @@ static proxy_worker *internal_find_best_byrequests(const proxy_balancer *balance workers = apr_pcalloc(r->pool, sizeof(proxy_worker *) * balancer->workers->nelts); #if HAVE_CLUSTER_EX_DEBUG - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "proxy: Entering byrequests for CLUSTER (%s) failoverdomain:%d", + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, + "internal_find_best_byrequests: Entering byrequests for CLUSTER (%s) failoverdomain:%d", balancer->s->name, failoverdomain); #endif @@ -1742,8 +1750,8 @@ static proxy_worker *internal_find_best_byrequests(const proxy_balancer *balance hash += session_id[i]; } mycandidate = workers[hash % workers_length]; - ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, r->server, "Using deterministic failover target: %s", - mycandidate->s->route); + ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, r->server, + "find_best_worker: Using deterministic failover target: %s", mycandidate->s->route); } if (mycandidate) { break; @@ -1764,11 +1772,11 @@ static proxy_worker *internal_find_best_byrequests(const proxy_balancer *balance } mycandidate->s->elected++; apr_table_setn(r->subprocess_env, "BALANCER_CONTEXT_ID", apr_psprintf(r->pool, "%d", mynodecontext->context)); - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "proxy: byrequests balancer DONE (%s)", + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "find_best_worker: byrequests balancer DONE (%s)", mycandidate->s->name_ex); } else { apr_table_setn(r->subprocess_env, "BALANCER_CONTEXT_ID", ""); - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "proxy: byrequests balancer FAILED"); + ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "find_best_worker: byrequests balancer FAILED"); } return mycandidate; } @@ -1939,7 +1947,7 @@ static proxy_worker *searchworker(request_rec *r, const char *bal, const char *p if (worker->s->index != -1) { *id = worker->s->index; ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "searchworker %s: worker->s->index: %d the_conf %ld", ptr, *id, (uintptr_t)conf); + "searchworker: %s worker->s->index: %d the_conf %ld", ptr, *id, (uintptr_t)conf); *the_conf = conf; return worker; /* Done current index */ } @@ -1947,18 +1955,18 @@ static proxy_worker *searchworker(request_rec *r, const char *bal, const char *p if (helper && helper->index != -1) { *id = helper->index; ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "searchworker %s: helper->index %d the_conf %ld", ptr, *id, (uintptr_t)conf); + "searchworker: %s helper->index %d the_conf %ld", ptr, *id, (uintptr_t)conf); *the_conf = conf; return worker; /* Done previous index */ } if (helper && helper->shared) { *id = helper->shared->index; ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "searchworker %s: helper->shared->index %d the_conf %ld", ptr, *id, (uintptr_t)conf); + "searchworker: %s helper->shared->index %d the_conf %ld", ptr, *id, (uintptr_t)conf); *the_conf = conf; return worker; /* our index was saved when we remove... */ } - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "searchworker %s: FAILED", ptr); + ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "searchworker: %s FAILED", ptr); return NULL; } } @@ -2122,7 +2130,7 @@ static int node_has_workers(const server_rec *server, const proxy_server_conf *c ap_assert(helper); /* we are in trouble ... */ if (helper->index == id) { ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, - "remove_removed_node %d for REMOVED node_has_workers %d (%s)", id, getpid(), + "remove_removed_node: %d for REMOVED node_has_workers %d (%s)", id, getpid(), worker->s->hostname_ex); return 1; } @@ -2130,7 +2138,7 @@ static int node_has_workers(const server_rec *server, const proxy_server_conf *c } ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, - "remove_removed_node %d for REMOVED node_has_workers NO WORKERS %d", id, getpid()); + "remove_removed_node: %d for REMOVED node_has_workers NO WORKERS %d", id, getpid()); return 0; } @@ -2158,15 +2166,15 @@ static void remove_removed_node(apr_pool_t *pool, const proxy_server_conf *conf, if (strcmp(ou->mess.JVMRoute, "REMOVED") == 0 && (now - ou->updatetime) >= wait_for_remove) { if (node_has_workers(server, conf, ou->mess.id)) { ou->updatetime = now; - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "remove_removed_node %d for REMOVED wait %d", + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "remove_removed_node: %d for REMOVED wait %d", ou->mess.id, getpid()); } else { ou->mess.num_remove_check++; - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "remove_removed_node %d %s for REMOVED done %d", + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "remove_removed_node: %d %s for REMOVED done %d", ou->mess.id, ou->mess.Port, getpid()); if (ou->mess.num_remove_check > 10) { ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, - "remove_removed_node %d %s for REMOVED done (DONE) %d", ou->mess.id, ou->mess.Port, + "remove_removed_node: %d %s for REMOVED done (DONE) %d", ou->mess.id, ou->mess.Port, getpid()); node_storage->remove_node(ou->mess.id); } @@ -2336,12 +2344,13 @@ static apr_status_t mc_watchdog_callback(int state, void *data, apr_pool_t *pool if (mc_thread_pool_size && mc_thread_pool == NULL) { res = apr_thread_pool_create(&mc_thread_pool, mc_thread_pool_size, mc_thread_pool_size, s->process->pool); if (res != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, "apr_thread_pool_create failed, threads will not be used"); + ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, + "mc_watchdog_callback: apr_thread_pool_create failed, threads will not be used"); mc_thread_pool = NULL; } } else { mc_thread_pool = NULL; - ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, "Threads are not used"); + ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, "mc_watchdog_callback: Threads are not used"); } #endif break; @@ -2363,7 +2372,7 @@ static apr_status_t mc_watchdog_callback(int state, void *data, apr_pool_t *pool #if MC_USE_THREADS res = apr_thread_pool_destroy(mc_thread_pool); if (res != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, "apr_thread_pool_destroy failed"); + ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, "mc_watchdog_callback: apr_thread_pool_destroy failed"); } mc_thread_pool = NULL; #endif @@ -2645,7 +2654,7 @@ static int proxy_cluster_trans(request_rec *r) apr_table_setn(r->notes, "balancer-table", (char *)balancer_table); apr_table_setn(r->notes, "node-table", (char *)node_table); - ap_log_rerror(APLOG_MARK, APLOG_TRACE8, 0, r, "proxy_cluster_trans for %d %s %s uri: %s args: %s unparsed_uri: %s", + ap_log_rerror(APLOG_MARK, APLOG_TRACE8, 0, r, "proxy_cluster_trans: for %d %s %s uri: %s args: %s unparsed_uri: %s", r->proxyreq, r->filename, r->handler, r->uri, r->args, r->unparsed_uri); balancer = get_route_balancer(r, conf, vhost_table, context_table, balancer_table, node_table, use_alias); @@ -2665,7 +2674,7 @@ static int proxy_cluster_trans(request_rec *r) rv = ap_proxy_trans_match(r, dconf->alias, dconf); if (rv != HTTP_CONTINUE) { ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, - "proxy_cluster_trans ap_proxy_trans_match(dconf) matches or reject %s to %s %d", + "proxy_cluster_trans: ap_proxy_trans_match(dconf) matches or reject %s to %s %d", r->uri, r->filename, rv); return rv; /* Done */ } @@ -2681,7 +2690,7 @@ static int proxy_cluster_trans(request_rec *r) rv = ap_proxy_trans_match(r, ent, dconf); if (rv != HTTP_CONTINUE) { ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, - "proxy_cluster_trans ap_proxy_trans_match(conf) matches or reject %s to %s %d", + "proxy_cluster_trans: ap_proxy_trans_match(conf) matches or reject %s to %s %d", r->uri, r->filename, rv); return rv; /* Done */ } @@ -2689,7 +2698,7 @@ static int proxy_cluster_trans(request_rec *r) } /* Here the ProxyPass or ProxyPassMatch have been checked and have NOT returned ERRROR nor OK */ - ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, "proxy_cluster_trans no match for ap_proxy_trans_match on:%s", + ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, "proxy_cluster_trans: no match for ap_proxy_trans_match on:%s", r->uri); /* Use proxy-nocanon if needed */ @@ -2706,11 +2715,11 @@ static int proxy_cluster_trans(request_rec *r) } r->handler = "proxy-server"; r->proxyreq = PROXYREQ_REVERSE; - ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, "proxy_cluster_trans using %s uri: %s", balancer, r->filename); + ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, "proxy_cluster_trans: using %s uri: %s", balancer, r->filename); return OK; /* Mod_proxy will process it */ } - ap_log_rerror(APLOG_MARK, APLOG_TRACE8, 0, r, "proxy_cluster_trans DECLINED %s uri: %s unparsed_uri: %s", + ap_log_rerror(APLOG_MARK, APLOG_TRACE8, 0, r, "proxy_cluster_trans: DECLINED %s uri: %s unparsed_uri: %s", balancer ? balancer : "", r->filename, r->unparsed_uri); return DECLINED; } @@ -2741,7 +2750,7 @@ static int proxy_cluster_canon(request_rec *r, char *url) */ err = ap_proxy_canon_netloc(r->pool, &url, NULL, NULL, &host, &port); if (err) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "error parsing URL %s: %s", url, err); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "proxy_cluster_canon: error parsing URL %s: %s", url, err); return HTTP_BAD_REQUEST; } /* @@ -2824,7 +2833,8 @@ static proxy_worker *find_route_worker(request_rec *r, const proxy_balancer *bal proxy_cluster_helper *helper = (*run)->context; worker = *run; if (index != helper->index) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "proxy: find_route_worker skipping BAD worker"); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, + "find_route_worker: find_route_worker skipping BAD worker"); continue; /* skip it */ } if (index == -1) { @@ -2947,9 +2957,9 @@ static proxy_worker *find_session_route(const proxy_balancer *balancer, request_ /* We already should have the route in the notes for the trans() */ *route = apr_table_get(r->notes, "session-route"); if (*route && (**route)) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "cluster: Using route %s", *route); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "find_session_route: Using route %s", *route); } else { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "cluster: No route found"); + ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "find_session_route: No route found"); return NULL; } @@ -2969,8 +2979,8 @@ static proxy_worker *find_session_route(const proxy_balancer *balancer, request_ * the route supplied by the client. (mod_proxy compatibility). */ apr_table_setn(r->subprocess_env, "BALANCER_ROUTE_CHANGED", "1"); - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "proxy: CLUSTER: Route changed from %s to %s", *route, - worker->s->route); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "find_session_route: CLUSTER: Route changed from %s to %s", + *route, worker->s->route); } return worker; } @@ -2984,8 +2994,8 @@ static proxy_worker *find_best_worker(const proxy_balancer *balancer, const prox apr_status_t rv; if ((rv = PROXY_THREAD_LOCK(balancer)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, "proxy: CLUSTER: (%s). Lock failed for find_best_worker()", - balancer->s->name); + ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, + "find_best_worker: CLUSTER: (%s). Lock failed for find_best_worker()", balancer->s->name); return NULL; } @@ -2993,8 +3003,8 @@ static proxy_worker *find_best_worker(const proxy_balancer *balancer, const prox node_table); if ((rv = PROXY_THREAD_UNLOCK(balancer)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, "proxy: CLUSTER: (%s). Unlock failed for find_best_worker()", - balancer->s->name); + ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, + "find_best_worker: CLUSTER: (%s). Unlock failed for find_best_worker()", balancer->s->name); } if (candidate == NULL) { @@ -3043,7 +3053,7 @@ static int rewrite_url(request_rec *r, const proxy_worker *worker, char **url) /* we break the URL into host, port, uri */ if (!worker) { return ap_proxyerror(r, HTTP_BAD_REQUEST, - apr_pstrcat(r->pool, "missing worker. URI cannot be parsed: ", *url, NULL)); + apr_pstrcat(r->pool, "rewrite_url: missing worker. URI cannot be parsed: ", *url, NULL)); } *url = apr_pstrcat(r->pool, worker->s->name_ex, path, NULL); @@ -3242,10 +3252,12 @@ static int proxy_cluster_pre_request(proxy_worker **worker, proxy_balancer **bal node_storage->unlock_nodes(); if (!(*balancer = ap_proxy_get_balancer(r->pool, conf, *url, 0))) { /* node_storage->unlock_nodes(); */ - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "proxy: CLUSTER no balancer for %s", *url); + ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "proxy_cluster_pre_request: CLUSTER no balancer for %s", + *url); return DECLINED; } - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "proxy: CLUSTER balancer CREATED for %s", *url); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, + "proxy_cluster_pre_request: CLUSTER balancer CREATED for %s", *url); } /* Step 2: find the session route */ @@ -3256,8 +3268,8 @@ static int proxy_cluster_pre_request(proxy_worker **worker, proxy_balancer **bal * XXX: perhaps we need the process lock here */ if ((rv = PROXY_THREAD_LOCK(*balancer)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, "proxy: CLUSTER: (%s). Lock failed for pre_request", - (*balancer)->s->name); + ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, + "proxy_cluster_pre_request: CLUSTER: (%s). Lock failed for pre_request", (*balancer)->s->name); return DECLINED; } if (runtime) { @@ -3271,23 +3283,24 @@ static int proxy_cluster_pre_request(proxy_worker **worker, proxy_balancer **bal * member of the same balancer in which case return 503 */ ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "proxy: CLUSTER: (%s). All workers are in error state for route (%s)", (*balancer)->s->name, - route); + "proxy_cluster_pre_request: CLUSTER: (%s). All workers are in error state for route (%s)", + (*balancer)->s->name, route); if ((rv = PROXY_THREAD_UNLOCK(*balancer)) != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: CLUSTER: (%s). Unlock failed for pre_request", (*balancer)->s->name); + "proxy_cluster_pre_request: CLUSTER: (%s). Unlock failed for pre_request", + (*balancer)->s->name); } return HTTP_SERVICE_UNAVAILABLE; } /* We try to to failover using another node in the domain */ - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "mod_proxy_cluster: failover in domain"); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "proxy_cluster_pre_request: failover in domain"); failoverdomain = 1; } if ((rv = PROXY_THREAD_UNLOCK(*balancer)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, "proxy: CLUSTER: (%s). Unlock failed for pre_request", - (*balancer)->s->name); + ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, + "proxy_cluster_pre_request: CLUSTER: (%s). Unlock failed for pre_request", (*balancer)->s->name); } if (!*worker) { /* We have to failover (in domain only may be) or we don't use sticky sessions */ @@ -3297,13 +3310,14 @@ static int proxy_cluster_pre_request(proxy_worker **worker, proxy_balancer **bal const char *no_context_error = apr_table_get(r->notes, "no-context-error"); if (no_context_error == NULL) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "proxy: CLUSTER: (%s). All workers are in error state", (*balancer)->s->name); + "proxy_cluster_pre_request: CLUSTER: (%s). All workers are in error state", + (*balancer)->s->name); return HTTP_SERVICE_UNAVAILABLE; } - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "proxy: CLUSTER: (%s). No context for the URL", - (*balancer)->s->name); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, + "proxy_cluster_pre_request: CLUSTER: (%s). No context for the URL", (*balancer)->s->name); return HTTP_NOT_FOUND; } if ((*balancer)->s->sticky[0] != '\0' && runtime) { @@ -3395,7 +3409,7 @@ static int proxy_cluster_post_request(proxy_worker *worker, proxy_balancer *bala node_storage->unlock_nodes(); #if HAVE_CLUSTER_EX_DEBUG - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "proxy_cluster_post_request for (%s) %s", balancer->s->name, + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "proxy_cluster_post_request: for (%s) %s", balancer->s->name, balancer->s->sticky); #endif @@ -3416,7 +3430,7 @@ static int proxy_cluster_post_request(proxy_worker *worker, proxy_balancer *bala sessionidinfo_t ou; #if HAVE_CLUSTER_EX_DEBUG ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy_cluster_post_request sessionid changed (%s to %s)", sessionid, cookie); + "proxy_cluster_post_request: sessionid changed (%s to %s)", sessionid, cookie); #endif strncpy(ou.sessionid, sessionid, SESSIONIDSZ); ou.id = -1; @@ -3442,15 +3456,15 @@ static int proxy_cluster_post_request(proxy_worker *worker, proxy_balancer *bala if (!apr_is_empty_array(balancer->errstatuses)) { int i; if ((rv = PROXY_THREAD_LOCK(balancer)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, "proxy: BALANCER: (%s). Lock failed for post_request", - balancer->s->name); + ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, + "proxy_cluster_post_request: BALANCER: (%s). Lock failed for post_request", balancer->s->name); return HTTP_INTERNAL_SERVER_ERROR; } for (i = 0; i < balancer->errstatuses->nelts; i++) { int val = ((int *)balancer->errstatuses->elts)[i]; if (r->status == val) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "%s: Forcing worker (%s) into error state " + "proxy_cluster_post_request: %s Forcing worker (%s) into error state " "due to status code %d matching 'failonstatus' " "balancer parameter", balancer->s->name, worker->s->name_ex, val); @@ -3460,12 +3474,13 @@ static int proxy_cluster_post_request(proxy_worker *worker, proxy_balancer *bala } } if ((rv = PROXY_THREAD_UNLOCK(balancer)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, "proxy: BALANCER: (%s). Unlock failed for post_request", + ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, + "proxy_cluster_post_request: BALANCER: (%s). Unlock failed for post_request", balancer->s->name); } } - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "proxy_cluster_post_request %d for (%s)", r->status, + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "proxy_cluster_post_request: %d for (%s)", r->status, balancer->s->name); return OK;