You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by rj...@apache.org on 2022/05/27 12:48:05 UTC
[tomcat-connectors] branch main updated: Use jk_request_log() instead of jk_log() where appropriate.
This is an automated email from the ASF dual-hosted git repository.
rjung pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat-connectors.git
The following commit(s) were added to refs/heads/main by this push:
new 5ca66fa8e Use jk_request_log() instead of jk_log() where appropriate.
5ca66fa8e is described below
commit 5ca66fa8e053ded50266ec3562c490ed95f75ac5
Author: Rainer Jung <ra...@kippdata.de>
AuthorDate: Fri May 27 14:47:53 2022 +0200
Use jk_request_log() instead of jk_log() where appropriate.
---
native/apache-2.0/mod_jk.c | 102 +++---
native/common/jk_ajp12_worker.c | 134 ++++----
native/common/jk_ajp14_worker.c | 14 +-
native/common/jk_ajp_common.c | 683 ++++++++++++++++++++--------------------
native/common/jk_ajp_common.h | 6 +-
native/common/jk_lb_worker.c | 178 +++++------
native/common/jk_status.c | 560 ++++++++++++++++----------------
native/iis/jk_isapi_plugin.c | 230 +++++++-------
8 files changed, 952 insertions(+), 955 deletions(-)
diff --git a/native/apache-2.0/mod_jk.c b/native/apache-2.0/mod_jk.c
index 28ae3217f..5aa9f9da0 100644
--- a/native/apache-2.0/mod_jk.c
+++ b/native/apache-2.0/mod_jk.c
@@ -344,9 +344,9 @@ static int JK_METHOD ws_start_response(jk_ws_service_t *s,
jk_server_conf_t *xconf = (jk_server_conf_t *)
ap_get_module_config(r->server->module_config,
&jk_module);
- jk_log(xconf->log, JK_LOG_INFO,
- "origin server sent 401 without"
- " WWW-Authenticate header");
+ jk_request_log(s, xconf->log, JK_LOG_INFO,
+ "origin server sent 401 without"
+ " WWW-Authenticate header");
}
}
return JK_TRUE;
@@ -514,8 +514,8 @@ static int JK_METHOD ws_write(jk_ws_service_t *s, const void *b, unsigned int l)
if (!s->response_started) {
if (main_log)
- jk_log(main_log, JK_LOG_INFO,
- "Write without start, starting with defaults");
+ jk_request_log(s, main_log, JK_LOG_INFO,
+ "Write without start, starting with defaults");
if (!s->start_response(s, 200, NULL, NULL, NULL, 0)) {
return JK_FALSE;
}
@@ -540,8 +540,8 @@ static int JK_METHOD ws_write(jk_ws_service_t *s, const void *b, unsigned int l)
while (ll > 0 && !p->r->connection->aborted) {
r = ap_rwrite(bb, ll, p->r);
if (JK_IS_DEBUG_LEVEL(main_log))
- jk_log(main_log, JK_LOG_DEBUG,
- "written %d out of %d", r, ll);
+ jk_request_log(s, main_log, JK_LOG_DEBUG,
+ "written %d out of %d", r, ll);
if (r < 0)
return JK_FALSE;
@@ -1057,9 +1057,9 @@ static int init_ws_service(apache_private_data_t * private_data,
if (s->ssl_cert) {
s->ssl_cert_len = (unsigned int)strlen(s->ssl_cert);
if (JK_IS_DEBUG_LEVEL(conf->log)) {
- jk_log(conf->log, JK_LOG_DEBUG,
- "SSL client certificate (%d bytes): %s",
- s->ssl_cert_len, s->ssl_cert);
+ jk_request_log(s, conf->log, JK_LOG_DEBUG,
+ "SSL client certificate (%d bytes): %s",
+ s->ssl_cert_len, s->ssl_cert);
}
}
s->ssl_protocol =
@@ -1176,26 +1176,26 @@ static int init_ws_service(apache_private_data_t * private_data,
* the remote tomcat
*/
if (JK_IS_DEBUG_LEVEL(conf->log)) {
- jk_log(conf->log, JK_LOG_DEBUG,
- "Service protocol=%s method=%s ssl=%s host=%s addr=%s name=%s port=%d auth=%s user=%s laddr=%s raddr=%s uaddr=%s uri=%s",
- STRNULL_FOR_NULL(s->protocol),
- STRNULL_FOR_NULL(s->method),
- s->is_ssl ? "true" : "false",
- STRNULL_FOR_NULL(s->remote_host),
- STRNULL_FOR_NULL(s->remote_addr),
- STRNULL_FOR_NULL(s->server_name),
- s->server_port,
- STRNULL_FOR_NULL(s->auth_type),
- STRNULL_FOR_NULL(s->remote_user),
- STRNULL_FOR_NULL(r->connection->local_ip),
+ jk_request_log(s, conf->log, JK_LOG_DEBUG,
+ "Service protocol=%s method=%s ssl=%s host=%s addr=%s name=%s port=%d auth=%s user=%s laddr=%s raddr=%s uaddr=%s uri=%s",
+ STRNULL_FOR_NULL(s->protocol),
+ STRNULL_FOR_NULL(s->method),
+ s->is_ssl ? "true" : "false",
+ STRNULL_FOR_NULL(s->remote_host),
+ STRNULL_FOR_NULL(s->remote_addr),
+ STRNULL_FOR_NULL(s->server_name),
+ s->server_port,
+ STRNULL_FOR_NULL(s->auth_type),
+ STRNULL_FOR_NULL(s->remote_user),
+ STRNULL_FOR_NULL(r->connection->local_ip),
#if (MODULE_MAGIC_NUMBER_MAJOR >= 20111130)
- STRNULL_FOR_NULL(r->connection->client_ip),
- STRNULL_FOR_NULL(r->useragent_ip),
+ STRNULL_FOR_NULL(r->connection->client_ip),
+ STRNULL_FOR_NULL(r->useragent_ip),
#else
- STRNULL_FOR_NULL(r->connection->remote_ip),
- STRNULL_FOR_NULL(r->connection->remote_ip),
+ STRNULL_FOR_NULL(r->connection->remote_ip),
+ STRNULL_FOR_NULL(r->connection->remote_ip),
#endif
- STRNULL_FOR_NULL(s->req_uri));
+ STRNULL_FOR_NULL(s->req_uri));
}
return JK_TRUE;
@@ -2785,7 +2785,7 @@ static int jk_handler(request_rec * r)
jk_log(xconf->log, JK_LOG_DEBUG,
"missing uri map for %s:%s",
xconf->s->server_hostname ? xconf->s->server_hostname : "_default_",
- r->uri);
+ r->uri);
}
else {
rule_extension_t *e;
@@ -2828,8 +2828,8 @@ static int jk_handler(request_rec * r)
/* If this is a proxy request, we'll notify an error */
if (r->proxyreq) {
jk_log(xconf->log, JK_LOG_INFO, "Proxy request for worker=%s"
- " is not allowed",
- STRNULL_FOR_NULL(worker_name));
+ " is not allowed",
+ STRNULL_FOR_NULL(worker_name));
JK_TRACE_EXIT(xconf->log);
return HTTP_INTERNAL_SERVER_ERROR;
}
@@ -2919,16 +2919,16 @@ static int jk_handler(request_rec * r)
}
}
if (JK_IS_DEBUG_LEVEL(xconf->log)) {
- jk_log(xconf->log, JK_LOG_DEBUG,
- "Consumed %d bytes of remaining request data for worker=%s",
- consumed, STRNULL_FOR_NULL(worker_name));
+ jk_request_log(&s, xconf->log, JK_LOG_DEBUG,
+ "Consumed %d bytes of remaining request data for worker=%s",
+ consumed, STRNULL_FOR_NULL(worker_name));
}
}
}
else { /* this means we couldn't get an endpoint */
- jk_log(xconf->log, JK_LOG_ERROR, "Could not get endpoint"
- " for worker=%s",
- worker_name);
+ jk_request_log(&s, xconf->log, JK_LOG_ERROR, "Could not get endpoint"
+ " for worker=%s",
+ worker_name);
rc = 0; /* just to make sure that we know we've failed */
is_error = HTTP_SERVICE_UNAVAILABLE;
}
@@ -2956,9 +2956,9 @@ static int jk_handler(request_rec * r)
if (s.extension.use_server_error_pages &&
s.http_response_status >= s.extension.use_server_error_pages) {
if (JK_IS_DEBUG_LEVEL(xconf->log))
- jk_log(xconf->log, JK_LOG_DEBUG, "Forwarding status=%d"
- " for worker=%s",
- s.http_response_status, worker_name);
+ jk_request_log(&s, xconf->log, JK_LOG_DEBUG, "Forwarding status=%d"
+ " for worker=%s",
+ s.http_response_status, worker_name);
JK_TRACE_EXIT(xconf->log);
return s.http_response_status;
}
@@ -2966,32 +2966,32 @@ static int jk_handler(request_rec * r)
let apache handle the error code */
if (!r->sent_bodyct && r->status >= HTTP_BAD_REQUEST) {
- jk_log(xconf->log, JK_LOG_INFO, "No body with status=%d"
- " for worker=%s",
- r->status, worker_name);
+ jk_request_log(&s, xconf->log, JK_LOG_INFO, "No body with status=%d"
+ " for worker=%s",
+ r->status, worker_name);
JK_TRACE_EXIT(xconf->log);
return r->status;
}
if (JK_IS_DEBUG_LEVEL(xconf->log))
- jk_log(xconf->log, JK_LOG_DEBUG, "Service finished"
- " with status=%d for worker=%s",
- r->status, worker_name);
+ jk_request_log(&s, xconf->log, JK_LOG_DEBUG, "Service finished"
+ " with status=%d for worker=%s",
+ r->status, worker_name);
JK_TRACE_EXIT(xconf->log);
return OK; /* NOT r->status, even if it has changed. */
}
else if (rc == JK_CLIENT_ERROR) {
if (is_error != HTTP_REQUEST_ENTITY_TOO_LARGE)
r->connection->aborted = 1;
- jk_log(xconf->log, JK_LOG_INFO, "Aborting connection"
- " for worker=%s",
- worker_name);
+ jk_request_log(&s, xconf->log, JK_LOG_INFO, "Aborting connection"
+ " for worker=%s",
+ worker_name);
JK_TRACE_EXIT(xconf->log);
return is_error;
}
else {
- jk_log(xconf->log, JK_LOG_INFO, "Service error=%d"
- " for worker=%s",
- rc, worker_name);
+ jk_request_log(&s, xconf->log, JK_LOG_INFO, "Service error=%d"
+ " for worker=%s",
+ rc, worker_name);
JK_TRACE_EXIT(xconf->log);
return is_error;
}
diff --git a/native/common/jk_ajp12_worker.c b/native/common/jk_ajp12_worker.c
index d28d48544..a403c9912 100644
--- a/native/common/jk_ajp12_worker.c
+++ b/native/common/jk_ajp12_worker.c
@@ -132,8 +132,8 @@ static int JK_METHOD service(jk_endpoint_t *e,
NULL,
JK_FALSE, 0, 0, 0, l);
- jk_log(l, JK_LOG_DEBUG, "In jk_endpoint_t::service, sd = %d",
- p->sd);
+ jk_request_log(s, l, JK_LOG_DEBUG, "In jk_endpoint_t::service, sd = %d",
+ p->sd);
if (IS_VALID_SOCKET(p->sd)) {
break;
}
@@ -142,15 +142,15 @@ static int JK_METHOD service(jk_endpoint_t *e,
jk_sb_open(&p->sb, p->sd);
if (ajpv12_handle_request(p, s, l)) {
- jk_log(l, JK_LOG_DEBUG,
- "In jk_endpoint_t::service, sent request");
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "In jk_endpoint_t::service, sent request");
rc = ajpv12_handle_response(p, s, l);
JK_TRACE_EXIT(l);
return rc;
}
}
- jk_log(l, JK_LOG_ERROR, "In jk_endpoint_t::service, Error sd = %d",
- p->sd);
+ jk_request_log(s, l, JK_LOG_ERROR, "In jk_endpoint_t::service, Error sd = %d",
+ p->sd);
*is_error = JK_HTTP_SERVER_ERROR;
JK_TRACE_EXIT(l);
@@ -402,12 +402,12 @@ static int ajpv12_handle_request(ajp12_endpoint_t * p,
{
int ret;
- jk_log(l, JK_LOG_DEBUG, "Into ajpv12_handle_request");
+ jk_request_log(s, l, JK_LOG_DEBUG, "Into ajpv12_handle_request");
/*
* Start the ajp 12 service sequence
*/
- jk_log(l, JK_LOG_DEBUG,
- "ajpv12_handle_request, sending the ajp12 start sequence");
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "ajpv12_handle_request, sending the ajp12 start sequence");
ret = (ajpv12_mark(p, 1) && ajpv12_sendstring(p, s->method) && ajpv12_sendstring(p, 0) && /* zone */
ajpv12_sendstring(p, 0) && /* servlet */
@@ -442,29 +442,29 @@ static int ajpv12_handle_request(ajp12_endpoint_t * p,
ajpv12_sendstring(p, "")); /* JSERV ajpv12 compatibility */
if (!ret) {
- jk_log(l, JK_LOG_ERROR,
- "In ajpv12_handle_request, failed to send the ajp12 start sequence");
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "In ajpv12_handle_request, failed to send the ajp12 start sequence");
return JK_FALSE;
}
if (s->num_attributes > 0) {
unsigned i;
- jk_log(l, JK_LOG_DEBUG,
- "ajpv12_handle_request, sending the environment variables");
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "ajpv12_handle_request, sending the environment variables");
for (i = 0; i < s->num_attributes; i++) {
ret = (ajpv12_mark(p, 5) &&
ajpv12_sendstring(p, s->attributes_names[i]) &&
ajpv12_sendstring(p, s->attributes_values[i]));
if (!ret) {
- jk_log(l, JK_LOG_ERROR,
- "In ajpv12_handle_request, failed to send environment");
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "In ajpv12_handle_request, failed to send environment");
return JK_FALSE;
}
}
}
- jk_log(l, JK_LOG_DEBUG, "ajpv12_handle_request, sending the headers");
+ jk_request_log(s, l, JK_LOG_DEBUG, "ajpv12_handle_request, sending the headers");
/* Send the request headers */
if (s->num_headers) {
@@ -475,20 +475,20 @@ static int ajpv12_handle_request(ajp12_endpoint_t * p,
ajpv12_sendstring(p, s->headers_values[i]));
if (!ret) {
- jk_log(l, JK_LOG_ERROR,
- "In ajpv12_handle_request, failed to send headers");
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "In ajpv12_handle_request, failed to send headers");
return JK_FALSE;
}
}
}
- jk_log(l, JK_LOG_DEBUG,
- "ajpv12_handle_request, sending the terminating mark");
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "ajpv12_handle_request, sending the terminating mark");
ret = (ajpv12_mark(p, 4) && ajpv12_flush(p));
if (!ret) {
- jk_log(l, JK_LOG_ERROR,
- "In ajpv12_handle_request, failed to send the terminating mark");
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "In ajpv12_handle_request, failed to send the terminating mark");
return JK_FALSE;
}
@@ -496,8 +496,8 @@ static int ajpv12_handle_request(ajp12_endpoint_t * p,
char buf[READ_BUF_SIZE];
jk_uint64_t so_far = 0;
- jk_log(l, JK_LOG_DEBUG,
- "ajpv12_handle_request, sending the request body");
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "ajpv12_handle_request, sending the request body");
while (so_far < s->content_length) {
unsigned this_time = 0;
@@ -510,32 +510,32 @@ static int ajpv12_handle_request(ajp12_endpoint_t * p,
}
if (!s->read(s, buf, to_read, &this_time)) {
- jk_log(l, JK_LOG_ERROR,
- "In ajpv12_handle_request, failed to read from the web server");
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "In ajpv12_handle_request, failed to read from the web server");
return JK_FALSE;
}
- jk_log(l, JK_LOG_DEBUG, "ajpv12_handle_request, read %d bytes",
- this_time);
+ jk_request_log(s, l, JK_LOG_DEBUG, "ajpv12_handle_request, read %d bytes",
+ this_time);
if (this_time > 0) {
so_far += this_time;
if ((int)this_time != send(p->sd, buf, this_time, 0)) {
- jk_log(l, JK_LOG_ERROR,
- "In ajpv12_handle_request, failed to write to the container");
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "In ajpv12_handle_request, failed to write to the container");
return JK_FALSE;
}
- jk_log(l, JK_LOG_DEBUG,
- "ajpv12_handle_request, sent %d bytes", this_time);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "ajpv12_handle_request, sent %d bytes", this_time);
}
else if (this_time == 0) {
- jk_log(l, JK_LOG_ERROR,
- "In ajpv12_handle_request, Error: short read. content length is %" JK_UINT64_T_FMT ", read %" JK_UINT64_T_FMT,
- s->content_length, so_far);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "In ajpv12_handle_request, Error: short read. content length is %" JK_UINT64_T_FMT ", read %" JK_UINT64_T_FMT,
+ s->content_length, so_far);
return JK_FALSE;
}
}
}
- jk_log(l, JK_LOG_DEBUG, "ajpv12_handle_request done");
+ jk_request_log(s, l, JK_LOG_DEBUG, "ajpv12_handle_request done");
return JK_TRUE;
}
@@ -550,7 +550,7 @@ static int ajpv12_handle_response(ajp12_endpoint_t * p,
int headers_len = 0;
int write_to_ws;
- jk_log(l, JK_LOG_DEBUG, "Into ajpv12_handle_response");
+ jk_request_log(s, l, JK_LOG_DEBUG, "Into ajpv12_handle_response");
/*
* Read headers ...
*/
@@ -563,18 +563,18 @@ static int ajpv12_handle_response(ajp12_endpoint_t * p,
#endif
if (!jk_sb_gets(&p->sb, &line)) {
- jk_log(l, JK_LOG_ERROR,
- "ajpv12_handle_response, error reading header line");
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "ajpv12_handle_response, error reading header line");
return JK_FALSE;
}
#if (defined(AS400) && !defined(AS400_UTF8)) || defined(_OSD_POSIX)
jk_xlate_from_ascii(line, strlen(line));
#endif
- jk_log(l, JK_LOG_DEBUG, "ajpv12_handle_response, read %s", line);
+ jk_request_log(s, l, JK_LOG_DEBUG, "ajpv12_handle_response, read %s", line);
if (0 == strlen(line)) {
- jk_log(l, JK_LOG_DEBUG,
- "ajpv12_handle_response, headers are done");
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "ajpv12_handle_response, headers are done");
break; /* Empty line -> end of headers */
}
@@ -583,13 +583,13 @@ static int ajpv12_handle_response(ajp12_endpoint_t * p,
name++; /* Skip leading white chars */
}
if (!*name) { /* Empty header name */
- jk_log(l, JK_LOG_ERROR,
- "ajpv12_handle_response, empty header name");
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "ajpv12_handle_response, empty header name");
return JK_FALSE;
}
if (!(value = strchr(name, ':'))) {
- jk_log(l, JK_LOG_ERROR,
- "ajpv12_handle_response, no value supplied");
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "ajpv12_handle_response, no value supplied");
return JK_FALSE; /* No value !!! */
}
*value = '\0';
@@ -598,12 +598,12 @@ static int ajpv12_handle_response(ajp12_endpoint_t * p,
value++; /* Skip leading white chars */
}
if (!*value) { /* Empty header value */
- jk_log(l, JK_LOG_ERROR,
- "ajpv12_handle_response, empty header value");
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "ajpv12_handle_response, empty header value");
return JK_FALSE;
}
- jk_log(l, JK_LOG_DEBUG, "ajpv12_handle_response, read %s=%s", name,
+ jk_request_log(s, l, JK_LOG_DEBUG, "ajpv12_handle_response, read %s=%s", name,
value);
if (0 == strcmp("Status", name)) {
#ifdef _MT_CODE_PTHREAD
@@ -614,8 +614,8 @@ static int ajpv12_handle_response(ajp12_endpoint_t * p,
status = atoi(numeric);
if (status < 100 || status > 999) {
- jk_log(l, JK_LOG_ERROR,
- "ajpv12_handle_response, invalid status code");
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "ajpv12_handle_response, invalid status code");
return JK_FALSE;
}
#ifdef _MT_CODE_PTHREAD
@@ -626,8 +626,8 @@ static int ajpv12_handle_response(ajp12_endpoint_t * p,
}
else {
if (headers_capacity == headers_len) {
- jk_log(l, JK_LOG_DEBUG,
- "ajpv12_handle_response, allocating header arrays");
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "ajpv12_handle_response, allocating header arrays");
names =
(char **)jk_pool_realloc(s->pool,
sizeof(char *) *
@@ -641,8 +641,8 @@ static int ajpv12_handle_response(ajp12_endpoint_t * p,
sizeof(char *) *
headers_capacity);
if (!values || !names) {
- jk_log(l, JK_LOG_ERROR,
- "ajpv12_handle_response, malloc error");
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "ajpv12_handle_response, malloc error");
return JK_FALSE;
}
headers_capacity = headers_capacity + 5;
@@ -653,19 +653,19 @@ static int ajpv12_handle_response(ajp12_endpoint_t * p,
}
}
- jk_log(l, JK_LOG_DEBUG, "ajpv12_handle_response, starting response");
+ jk_request_log(s, l, JK_LOG_DEBUG, "ajpv12_handle_response, starting response");
if (!s->start_response(s,
status,
reason,
(const char *const *)names,
(const char *const *)values, headers_len)) {
- jk_log(l, JK_LOG_ERROR,
- "ajpv12_handle_response, error starting response");
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "ajpv12_handle_response, error starting response");
return JK_FALSE;
}
- jk_log(l, JK_LOG_DEBUG,
- "ajpv12_handle_response, reading response body");
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "ajpv12_handle_response, reading response body");
/*
* Read response body
*/
@@ -676,26 +676,26 @@ static int ajpv12_handle_response(ajp12_endpoint_t * p,
char *buf = NULL;
if (!jk_sb_read(&p->sb, &buf, to_read, &acc)) {
- jk_log(l, JK_LOG_ERROR,
- "ajpv12_handle_response, error reading from ");
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "ajpv12_handle_response, error reading from ");
return JK_FALSE;
}
if (!acc) {
- jk_log(l, JK_LOG_DEBUG,
- "ajpv12_handle_response, response body is done");
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "ajpv12_handle_response, response body is done");
break;
}
if (write_to_ws) {
if (!s->write(s, buf, acc)) {
- jk_log(l, JK_LOG_ERROR,
- "ajpv12_handle_response, error writing back to server");
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "ajpv12_handle_response, error writing back to server");
write_to_ws = JK_FALSE;
}
}
}
- jk_log(l, JK_LOG_DEBUG, "ajpv12_handle_response done");
+ jk_request_log(s, l, JK_LOG_DEBUG, "ajpv12_handle_response done");
return JK_TRUE;
}
diff --git a/native/common/jk_ajp14_worker.c b/native/common/jk_ajp14_worker.c
index 65a48bc4f..10838a080 100644
--- a/native/common/jk_ajp14_worker.c
+++ b/native/common/jk_ajp14_worker.c
@@ -53,7 +53,7 @@ static int handle_discovery(ajp_endpoint_t * ae,
jk_log(l, JK_LOG_DEBUG, "send query");
- if (ajp_connection_tcp_send_message(ae, msg, l) != JK_TRUE) {
+ if (ajp_connection_tcp_send_message(NULL, ae, msg, l) != JK_TRUE) {
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -61,7 +61,7 @@ static int handle_discovery(ajp_endpoint_t * ae,
jk_b_reset(msg);
- if (ajp_connection_tcp_get_message(ae, msg, l) != JK_TRUE) {
+ if (ajp_connection_tcp_get_message(NULL, ae, msg, l) != JK_TRUE) {
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -151,7 +151,7 @@ static int handle_logon(ajp_endpoint_t * ae,
jk_log(l, JK_LOG_DEBUG, "send init");
- if (ajp_connection_tcp_send_message(ae, msg, l) != JK_TRUE) {
+ if (ajp_connection_tcp_send_message(NULL, ae, msg, l) != JK_TRUE) {
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -159,7 +159,7 @@ static int handle_logon(ajp_endpoint_t * ae,
jk_b_reset(msg);
- if (ajp_connection_tcp_get_message(ae, msg, l) != JK_TRUE) {
+ if (ajp_connection_tcp_get_message(NULL, ae, msg, l) != JK_TRUE) {
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -184,13 +184,13 @@ static int handle_logon(ajp_endpoint_t * ae,
JK_TRACE_EXIT(l);
return JK_FALSE;
}
- if (ajp_connection_tcp_send_message(ae, msg, l) != JK_TRUE) {
+ if (ajp_connection_tcp_send_message(NULL, ae, msg, l) != JK_TRUE) {
JK_TRACE_EXIT(l);
return JK_FALSE;
}
jk_b_reset(msg);
- if (ajp_connection_tcp_get_message(ae, msg, l) != JK_TRUE) {
+ if (ajp_connection_tcp_get_message(NULL, ae, msg, l) != JK_TRUE) {
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -331,7 +331,7 @@ static int JK_METHOD init(jk_worker_t *pThis,
}
ae = je->endpoint_private;
- if (ajp_connect_to_endpoint(ae, l) == JK_TRUE) {
+ if (ajp_connect_to_endpoint(NULL, ae, l) == JK_TRUE) {
/* connection stage passed - try to get context info
* this is the long awaited autoconf feature :)
diff --git a/native/common/jk_ajp_common.c b/native/common/jk_ajp_common.c
index 1d999676e..064715cb1 100644
--- a/native/common/jk_ajp_common.c
+++ b/native/common/jk_ajp_common.c
@@ -440,8 +440,8 @@ static int ajp_marshal_into_msgb(jk_msg_buf_t *msg,
jk_b_append_byte(msg, (unsigned char)(s->is_ssl)) ||
jk_b_append_int(msg, (unsigned short)(s->num_headers))) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed appending the message begining", ae->worker->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed appending the message begining", ae->worker->name);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -451,27 +451,27 @@ static int ajp_marshal_into_msgb(jk_msg_buf_t *msg,
if ((sc = sc_for_req_header(s->headers_names[i])) != UNKNOWN_METHOD) {
if (jk_b_append_int(msg, (unsigned short)sc)) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed appending the header code for '%s'",
- ae->worker->name, s->headers_names[i]);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed appending the header code for '%s'",
+ ae->worker->name, s->headers_names[i]);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
}
else {
if (jk_b_append_string(msg, s->headers_names[i])) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed appending the header name '%s'",
- ae->worker->name, s->headers_names[i]);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed appending the header name '%s'",
+ ae->worker->name, s->headers_names[i]);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
}
if (jk_b_append_string(msg, s->headers_values[i])) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed appending the header value for header '%s' of length %u",
- ae->worker->name, s->headers_names[i], strlen(s->headers_names[i]));
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed appending the header value for header '%s' of length %u",
+ ae->worker->name, s->headers_names[i], strlen(s->headers_names[i]));
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -480,8 +480,8 @@ static int ajp_marshal_into_msgb(jk_msg_buf_t *msg,
if (s->secret) {
if (jk_b_append_byte(msg, SC_A_SECRET) ||
jk_b_append_string(msg, s->secret)) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed appending secret", ae->worker->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed appending secret", ae->worker->name);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -490,8 +490,8 @@ static int ajp_marshal_into_msgb(jk_msg_buf_t *msg,
if (s->remote_user) {
if (jk_b_append_byte(msg, SC_A_REMOTE_USER) ||
jk_b_append_string(msg, s->remote_user)) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed appending the remote user", ae->worker->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed appending the remote user", ae->worker->name);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -499,8 +499,8 @@ static int ajp_marshal_into_msgb(jk_msg_buf_t *msg,
if (s->auth_type) {
if (jk_b_append_byte(msg, SC_A_AUTH_TYPE) ||
jk_b_append_string(msg, s->auth_type)) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed appending the auth type", ae->worker->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed appending the auth type", ae->worker->name);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -512,9 +512,9 @@ static int ajp_marshal_into_msgb(jk_msg_buf_t *msg,
#else
jk_b_append_string(msg, s->query_string)) {
#endif
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed appending the query string of length %u",
- ae->worker->name, strlen(s->query_string));
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed appending the query string of length %u",
+ ae->worker->name, strlen(s->query_string));
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -522,8 +522,8 @@ static int ajp_marshal_into_msgb(jk_msg_buf_t *msg,
if (s->route) {
if (jk_b_append_byte(msg, SC_A_ROUTE) ||
jk_b_append_string(msg, s->route)) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed appending the route", ae->worker->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed appending the route", ae->worker->name);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -531,8 +531,8 @@ static int ajp_marshal_into_msgb(jk_msg_buf_t *msg,
if (s->ssl_cert_len) {
if (jk_b_append_byte(msg, SC_A_SSL_CERT) ||
jk_b_append_string(msg, s->ssl_cert)) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed appending the SSL certificates", ae->worker->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed appending the SSL certificates", ae->worker->name);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -541,8 +541,8 @@ static int ajp_marshal_into_msgb(jk_msg_buf_t *msg,
if (s->ssl_cipher) {
if (jk_b_append_byte(msg, SC_A_SSL_CIPHER) ||
jk_b_append_string(msg, s->ssl_cipher)) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed appending the SSL ciphers", ae->worker->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed appending the SSL ciphers", ae->worker->name);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -550,8 +550,8 @@ static int ajp_marshal_into_msgb(jk_msg_buf_t *msg,
if (s->ssl_session) {
if (jk_b_append_byte(msg, SC_A_SSL_SESSION) ||
jk_b_append_string(msg, s->ssl_session)) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed appending the SSL session", ae->worker->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed appending the SSL session", ae->worker->name);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -565,9 +565,9 @@ static int ajp_marshal_into_msgb(jk_msg_buf_t *msg,
if (s->ssl_key_size != -1) {
if (jk_b_append_byte(msg, SC_A_SSL_KEY_SIZE) ||
jk_b_append_int(msg, (unsigned short)s->ssl_key_size)) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed appending the SSL key size of length %d",
- ae->worker->name, s->ssl_key_size);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed appending the SSL key size of length %d",
+ ae->worker->name, s->ssl_key_size);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -576,12 +576,12 @@ static int ajp_marshal_into_msgb(jk_msg_buf_t *msg,
/* If the method was unrecognized, encode it as an attribute */
if (method == SC_M_JK_STORED) {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG, "(%s) unknown method %s",
- ae->worker->name, s->method);
+ jk_request_log(s, l, JK_LOG_DEBUG, "(%s) unknown method %s",
+ ae->worker->name, s->method);
if (jk_b_append_byte(msg, SC_A_STORED_METHOD) ||
jk_b_append_string(msg, s->method)) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed appending the request method", ae->worker->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed appending the request method", ae->worker->name);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -595,9 +595,9 @@ static int ajp_marshal_into_msgb(jk_msg_buf_t *msg,
if (jk_b_append_byte(msg, SC_A_REQ_ATTRIBUTE) ||
jk_b_append_string(msg, SC_A_SSL_PROTOCOL) ||
jk_b_append_string(msg, s->ssl_protocol)) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed appending the ssl protocol name %s",
- ae->worker->name, s->ssl_protocol);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed appending the ssl protocol name %s",
+ ae->worker->name, s->ssl_protocol);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -612,9 +612,9 @@ static int ajp_marshal_into_msgb(jk_msg_buf_t *msg,
if (jk_b_append_byte(msg, SC_A_REQ_ATTRIBUTE) ||
jk_b_append_string(msg, SC_A_REQ_REMOTE_PORT) ||
jk_b_append_string(msg, s->remote_port)) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed appending the remote port %s",
- ae->worker->name, s->remote_port);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed appending the remote port %s",
+ ae->worker->name, s->remote_port);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -628,9 +628,9 @@ static int ajp_marshal_into_msgb(jk_msg_buf_t *msg,
if (jk_b_append_byte(msg, SC_A_REQ_ATTRIBUTE) ||
jk_b_append_string(msg, SC_A_REQ_LOCAL_ADDR) ||
jk_b_append_string(msg, s->local_addr)) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed appending the local address %s",
- ae->worker->name, s->local_addr);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed appending the local address %s",
+ ae->worker->name, s->local_addr);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -648,9 +648,9 @@ static int ajp_marshal_into_msgb(jk_msg_buf_t *msg,
if (jk_b_append_byte(msg, SC_A_REQ_ATTRIBUTE) ||
jk_b_append_string(msg, SC_A_JK_LB_ACTIVATION) ||
jk_b_append_string(msg, s->activation)) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed appending the activation state %s",
- ae->worker->name, s->activation);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed appending the activation state %s",
+ ae->worker->name, s->activation);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -660,9 +660,9 @@ static int ajp_marshal_into_msgb(jk_msg_buf_t *msg,
if (jk_b_append_byte(msg, SC_A_REQ_ATTRIBUTE) ||
jk_b_append_string(msg, s->attributes_names[i]) ||
jk_b_append_string(msg, s->attributes_values[i])) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed appending attribute %s=%s",
- ae->worker->name, s->attributes_names[i], s->attributes_values[i]);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed appending attribute %s=%s",
+ ae->worker->name, s->attributes_names[i], s->attributes_values[i]);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -670,14 +670,14 @@ static int ajp_marshal_into_msgb(jk_msg_buf_t *msg,
}
if (jk_b_append_byte(msg, SC_A_ARE_DONE)) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed appending the message end", ae->worker->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed appending the message end", ae->worker->name);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG, "(%s) ajp marshaling done", ae->worker->name);
+ jk_request_log(s, l, JK_LOG_DEBUG, "(%s) ajp marshaling done", ae->worker->name);
JK_TRACE_EXIT(l);
return JK_TRUE;
}
@@ -922,15 +922,13 @@ static int ajp_next_connection(ajp_endpoint_t *ae, jk_logger_t *l)
}
/** Handle the cping/cpong query
- * @param ae endpoint
- * @param timeout wait timeout in milliseconds
- * @param l logger
* @return JK_FALSE: failure
* JK_TRUE: success
* @remark Always closes socket in case of
* a socket error
*/
-static int ajp_handle_cping_cpong(ajp_endpoint_t * ae, int timeout, jk_logger_t *l)
+static int ajp_handle_cping_cpong(jk_ws_service_t *s, ajp_endpoint_t * ae,
+ int timeout, jk_logger_t *l)
{
int i;
int cmd;
@@ -941,16 +939,16 @@ static int ajp_handle_cping_cpong(ajp_endpoint_t * ae, int timeout, jk_logger_t
ae->last_errno = 0;
msg = jk_b_new(&ae->pool);
if (!msg) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) Failed allocating AJP message",
- ae->worker->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) Failed allocating AJP message",
+ ae->worker->name);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
if (jk_b_set_buffer_size(msg, 16)) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) Failed allocating AJP message buffer",
- ae->worker->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) Failed allocating AJP message buffer",
+ ae->worker->name);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -959,10 +957,10 @@ static int ajp_handle_cping_cpong(ajp_endpoint_t * ae, int timeout, jk_logger_t
/* Send CPing query
*/
- if (ajp_connection_tcp_send_message(ae, msg, l) != JK_TRUE) {
- jk_log(l, JK_LOG_INFO,
- "(%s) can't send cping query",
- ae->worker->name);
+ if (ajp_connection_tcp_send_message(s, ae, msg, l) != JK_TRUE) {
+ jk_request_log(s, l, JK_LOG_INFO,
+ "(%s) can't send cping query",
+ ae->worker->name);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -972,9 +970,9 @@ static int ajp_handle_cping_cpong(ajp_endpoint_t * ae, int timeout, jk_logger_t
*/
if (jk_is_input_event(ae->sd, timeout, l) == JK_FALSE) {
ae->last_errno = errno;
- jk_log(l, JK_LOG_INFO, "(%s) timeout in reply cpong after %d ms. "
- "Socket = %d (event=%d)",
- ae->worker->name, timeout, ae->sd, errno);
+ jk_request_log(s, l, JK_LOG_INFO, "(%s) timeout in reply cpong after %d ms. "
+ "Socket = %d (event=%d)",
+ ae->worker->name, timeout, ae->sd, errno);
/* We can't trust this connection any more.
*/
ajp_abort_endpoint(ae, JK_TRUE, l);
@@ -984,10 +982,10 @@ static int ajp_handle_cping_cpong(ajp_endpoint_t * ae, int timeout, jk_logger_t
/* Read and check for Pong reply
*/
- if (ajp_connection_tcp_get_message(ae, msg, l) != JK_TRUE) {
- jk_log(l, JK_LOG_INFO,
- "(%s) awaited reply cpong, not received",
- ae->worker->name);
+ if (ajp_connection_tcp_get_message(s, ae, msg, l) != JK_TRUE) {
+ jk_request_log(s, l, JK_LOG_INFO,
+ "(%s) awaited reply cpong, not received",
+ ae->worker->name);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -1003,10 +1001,10 @@ static int ajp_handle_cping_cpong(ajp_endpoint_t * ae, int timeout, jk_logger_t
if (i || ae->last_op == JK_AJP13_END_RESPONSE ||
cmd < JK_AJP13_SEND_BODY_CHUNK ||
cmd > AJP13_CPONG_REPLY) {
- jk_log(l, JK_LOG_WARNING,
- "(%s) awaited reply cpong, received %d instead. "
- "Closing connection",
- ae->worker->name, cmd);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "(%s) awaited reply cpong, received %d instead. "
+ "Closing connection",
+ ae->worker->name, cmd);
/* We can't trust this connection any more.
*/
ajp_abort_endpoint(ae, JK_TRUE, l);
@@ -1014,10 +1012,10 @@ static int ajp_handle_cping_cpong(ajp_endpoint_t * ae, int timeout, jk_logger_t
return JK_FALSE;
}
else {
- jk_log(l, JK_LOG_INFO,
- "(%s) awaited reply cpong, received %d instead. "
- "Retrying next packet",
- ae->worker->name, cmd);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "(%s) awaited reply cpong, received %d instead. "
+ "Retrying next packet",
+ ae->worker->name, cmd);
}
}
@@ -1041,7 +1039,7 @@ static int ajp_handle_cping_cpong(ajp_endpoint_t * ae, int timeout, jk_logger_t
* a socket error
* @remark Cares about ae->last_errno
*/
-int ajp_connect_to_endpoint(ajp_endpoint_t * ae, jk_logger_t *l)
+int ajp_connect_to_endpoint(jk_ws_service_t *s, ajp_endpoint_t * ae, jk_logger_t *l)
{
char buf[64];
int rc = JK_TRUE;
@@ -1061,10 +1059,10 @@ int ajp_connect_to_endpoint(ajp_endpoint_t * ae, jk_logger_t *l)
if (!IS_VALID_SOCKET(ae->sd)) {
ae->last_errno = errno;
- jk_log(l, JK_LOG_INFO,
- "(%s) Failed opening socket to (%s) (errno=%d)",
- ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf, sizeof(buf)),
- ae->last_errno);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "(%s) Failed opening socket to (%s) (errno=%d)",
+ ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf, sizeof(buf)),
+ ae->last_errno);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -1084,9 +1082,9 @@ int ajp_connect_to_endpoint(ajp_endpoint_t * ae, jk_logger_t *l)
if (ae->worker->logon != NULL) {
rc = ae->worker->logon(ae, l);
if (rc == JK_FALSE) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) ajp14 worker logon to the backend server failed",
- ae->worker->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) ajp14 worker logon to the backend server failed",
+ ae->worker->name);
/* Close the socket if unable to logon
*/
ajp_abort_endpoint(ae, JK_TRUE, l);
@@ -1095,12 +1093,12 @@ int ajp_connect_to_endpoint(ajp_endpoint_t * ae, jk_logger_t *l)
/* XXX: Should we send a cping also after logon to validate the connection?
*/
else if (ae->worker->connect_timeout > 0) {
- rc = ajp_handle_cping_cpong(ae, ae->worker->connect_timeout, l);
+ rc = ajp_handle_cping_cpong(s, ae, ae->worker->connect_timeout, l);
if (rc == JK_FALSE)
- jk_log(l, JK_LOG_ERROR,
- "(%s) cping/cpong after connecting to the backend server failed "
- "(errno=%d)",
- ae->worker->name, ae->last_errno);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) cping/cpong after connecting to the backend server failed "
+ "(errno=%d)",
+ ae->worker->name, ae->last_errno);
}
JK_TRACE_EXIT(l);
return rc;
@@ -1249,7 +1247,7 @@ void jk_ajp_push(ajp_worker_t * aw, int locked, jk_logger_t *l)
* a socket error, or JK_FATAL_ERROR
* @remark Cares about ae->last_errno
*/
-int ajp_connection_tcp_send_message(ajp_endpoint_t * ae,
+int ajp_connection_tcp_send_message(jk_ws_service_t *s, ajp_endpoint_t *ae,
jk_msg_buf_t *msg, jk_logger_t *l)
{
int rc;
@@ -1268,9 +1266,9 @@ int ajp_connection_tcp_send_message(ajp_endpoint_t * ae,
jk_dump_buff(l, JK_LOG_DEBUG, "sending to ajp14", msg);
}
else {
- jk_log(l, JK_LOG_ERROR,
- "(%s) unknown protocol %d, supported are AJP13/AJP14",
- ae->worker->name, ae->proto);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) unknown protocol %d, supported are AJP13/AJP14",
+ ae->worker->name, ae->proto);
/* We've got a protocol error.
* We can't trust this connection any more,
* because we might have send already parts of the request.
@@ -1292,18 +1290,15 @@ int ajp_connection_tcp_send_message(ajp_endpoint_t * ae,
return JK_TRUE;
}
ae->last_errno = errno;
- jk_log(l, JK_LOG_INFO,
- "(%s) sendfull for socket %d returned %d (errno=%d)",
- ae->worker->name, ae->sd, rc, ae->last_errno);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "(%s) sendfull for socket %d returned %d (errno=%d)",
+ ae->worker->name, ae->sd, rc, ae->last_errno);
ajp_abort_endpoint(ae, JK_FALSE, l);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
/** Receive a message from an endpoint, checking PROTO HEADER
- * @param ae endpoint
- * @param msg message to send
- * @param l logger
* @return JK_TRUE: success
* JK_FALSE: could not read the AJP packet header
* JK_AJP_PROTOCOL_ERROR: failure after reading
@@ -1312,7 +1307,7 @@ int ajp_connection_tcp_send_message(ajp_endpoint_t * ae,
* a socket error
* @remark Cares about ae->last_errno
*/
-int ajp_connection_tcp_get_message(ajp_endpoint_t * ae,
+int ajp_connection_tcp_get_message(jk_ws_service_t *s, ajp_endpoint_t * ae,
jk_msg_buf_t *msg, jk_logger_t *l)
{
unsigned char head[AJP_HEADER_LEN];
@@ -1335,19 +1330,19 @@ int ajp_connection_tcp_get_message(ajp_endpoint_t * ae,
if (rc < 0) {
if (rc == JK_SOCKET_EOF) {
ae->last_errno = EPIPE;
- jk_log(l, JK_LOG_INFO,
- "(%s) can't receive the response header message from tomcat, "
- "tomcat (%s) has forced a connection close for socket %d",
- ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf, sizeof(buf)),
- ae->sd);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "(%s) can't receive the response header message from tomcat, "
+ "tomcat (%s) has forced a connection close for socket %d",
+ ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf, sizeof(buf)),
+ ae->sd);
}
else {
ae->last_errno = -rc;
- jk_log(l, JK_LOG_INFO,
- "(%s) can't receive the response header message from tomcat, "
- "network problems or tomcat (%s) is down (errno=%d)",
- ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf, sizeof(buf)),
- ae->last_errno);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "(%s) can't receive the response header message from tomcat, "
+ "network problems or tomcat (%s) is down (errno=%d)",
+ ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf, sizeof(buf)),
+ ae->last_errno);
}
ajp_abort_endpoint(ae, JK_FALSE, l);
JK_TRACE_EXIT(l);
@@ -1360,15 +1355,15 @@ int ajp_connection_tcp_get_message(ajp_endpoint_t * ae,
if (header != AJP13_SW_HEADER) {
if (header == AJP14_SW_HEADER) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) received AJP14 reply on an AJP13 connection from %s",
- ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf, sizeof(buf)));
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) received AJP14 reply on an AJP13 connection from %s",
+ ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf, sizeof(buf)));
}
else {
- jk_log(l, JK_LOG_ERROR,
- "(%s) wrong message format 0x%04x from %s",
- ae->worker->name, header, jk_dump_hinfo(&ae->worker->worker_inet_addr,
- buf, sizeof(buf)));
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) wrong message format 0x%04x from %s",
+ ae->worker->name, header, jk_dump_hinfo(&ae->worker->worker_inet_addr,
+ buf, sizeof(buf)));
}
/* We've got a protocol error.
* We can't trust this connection any more.
@@ -1382,15 +1377,15 @@ int ajp_connection_tcp_get_message(ajp_endpoint_t * ae,
if (header != AJP14_SW_HEADER) {
if (header == AJP13_SW_HEADER) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) received AJP13 reply on an AJP14 connection from %s",
- ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf, sizeof(buf)));
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) received AJP13 reply on an AJP14 connection from %s",
+ ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf, sizeof(buf)));
}
else {
- jk_log(l, JK_LOG_ERROR,
- "(%s) wrong message format 0x%04x from %s",
- ae->worker->name, header, jk_dump_hinfo(&ae->worker->worker_inet_addr,
- buf, sizeof(buf)));
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) wrong message format 0x%04x from %s",
+ ae->worker->name, header, jk_dump_hinfo(&ae->worker->worker_inet_addr,
+ buf, sizeof(buf)));
}
/* We've got a protocol error.
* We can't trust this connection any more.
@@ -1405,10 +1400,10 @@ int ajp_connection_tcp_get_message(ajp_endpoint_t * ae,
msglen += (head[3] & 0xFF);
if (msglen > msg->maxlen) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) wrong message size %d %d from %s",
- ae->worker->name, msglen, msg->maxlen,
- jk_dump_hinfo(&ae->worker->worker_inet_addr, buf, sizeof(buf)));
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) wrong message size %d %d from %s",
+ ae->worker->name, msglen, msg->maxlen,
+ jk_dump_hinfo(&ae->worker->worker_inet_addr, buf, sizeof(buf)));
/* We've got a protocol error.
* We can't trust this connection any more.
*/
@@ -1430,19 +1425,19 @@ int ajp_connection_tcp_get_message(ajp_endpoint_t * ae,
if (rc < 0) {
if (rc == JK_SOCKET_EOF) {
ae->last_errno = EPIPE;
- jk_log(l, JK_LOG_ERROR,
- "(%s) can't receive the response body message from tomcat, "
- "tomcat (%s) has forced a connection close for socket %d",
- ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf, sizeof(buf)),
- ae->sd);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) can't receive the response body message from tomcat, "
+ "tomcat (%s) has forced a connection close for socket %d",
+ ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf, sizeof(buf)),
+ ae->sd);
}
else {
ae->last_errno = -rc;
- jk_log(l, JK_LOG_ERROR,
- "(%s) can't receive the response body message from tomcat, "
- "network problems or tomcat (%s) is down (errno=%d)",
- ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf, sizeof(buf)),
- ae->last_errno);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) can't receive the response body message from tomcat, "
+ "network problems or tomcat (%s) is down (errno=%d)",
+ ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf, sizeof(buf)),
+ ae->last_errno);
}
ajp_abort_endpoint(ae, JK_FALSE, l);
JK_TRACE_EXIT(l);
@@ -1546,10 +1541,10 @@ static int ajp_read_into_msg_buff(ajp_endpoint_t * ae,
}
if ((len = ajp_read_fully_from_server(s, l, read_buf, len)) < 0) {
- jk_log(l, JK_LOG_INFO,
- "(%s) receiving data from client failed. "
- "Connection aborted or network problems",
- ae->worker->name);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "(%s) receiving data from client failed. "
+ "Connection aborted or network problems",
+ ae->worker->name);
JK_TRACE_EXIT(l);
return JK_CLIENT_RD_ERROR;
}
@@ -1563,8 +1558,8 @@ static int ajp_read_into_msg_buff(ajp_endpoint_t * ae,
* an empty body packet
*/
if (0 != jk_b_append_int(msg, (unsigned short)len)) {
- jk_log(l, JK_LOG_INFO,
- "(%s) Failed appending message length", ae->worker->name);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "(%s) Failed appending message length", ae->worker->name);
JK_TRACE_EXIT(l);
return JK_CLIENT_RD_ERROR;
}
@@ -1620,10 +1615,10 @@ static int ajp_send_request(jk_endpoint_t *e,
*/
if (ae->last_op != JK_AJP13_END_RESPONSE &&
ae->last_op != AJP13_CPONG_REPLY) {
- jk_log(l, JK_LOG_INFO,
- "(%s) did not receive END_RESPONSE, "
- "closing socket %d",
- ae->worker->name, ae->sd);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "(%s) did not receive END_RESPONSE, "
+ "closing socket %d",
+ ae->worker->name, ae->sd);
ajp_abort_endpoint(ae, JK_TRUE, l);
}
/* First try to check open connections...
@@ -1632,10 +1627,10 @@ static int ajp_send_request(jk_endpoint_t *e,
int err = JK_FALSE;
if (jk_is_socket_connected(ae->sd, l) == JK_FALSE) {
ae->last_errno = errno;
- jk_log(l, JK_LOG_DEBUG,
- "(%s) failed sending request, "
- "socket %d is not connected any more (errno=%d)",
- ae->worker->name, ae->sd, ae->last_errno);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "(%s) failed sending request, "
+ "socket %d is not connected any more (errno=%d)",
+ ae->worker->name, ae->sd, ae->last_errno);
ajp_abort_endpoint(ae, JK_FALSE, l);
err = JK_TRUE;
err_conn++;
@@ -1645,12 +1640,12 @@ static int ajp_send_request(jk_endpoint_t *e,
* If the socket is disconnected no need to handle
* the cping/cpong
*/
- if (ajp_handle_cping_cpong(ae,
+ if (ajp_handle_cping_cpong(s, ae,
ae->worker->prepost_timeout, l) == JK_FALSE) {
- jk_log(l, JK_LOG_INFO,
- "(%s) failed sending request, "
- "socket %d prepost cping/cpong failure (errno=%d)",
- ae->worker->name, ae->sd, ae->last_errno);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "(%s) failed sending request, "
+ "socket %d prepost cping/cpong failure (errno=%d)",
+ ae->worker->name, ae->sd, ae->last_errno);
/* XXX: Is there any reason to try other
* connections to the node if one of them fails
* the cping/cpong heartbeat?
@@ -1667,7 +1662,7 @@ static int ajp_send_request(jk_endpoint_t *e,
* cping/cpong worked, so let's send the request now.
*/
if (err == JK_FALSE) {
- rc = ajp_connection_tcp_send_message(ae, op->request, l);
+ rc = ajp_connection_tcp_send_message(s, ae, op->request, l);
/* If this worked, we can break out of the loop
* and proceed with the request.
*/
@@ -1680,12 +1675,12 @@ static int ajp_send_request(jk_endpoint_t *e,
err_send++;
if (rc == JK_FATAL_ERROR)
op->recoverable = JK_FALSE;
- jk_log(l, JK_LOG_INFO,
- "(%s) failed sending request (%srecoverable) "
- "(errno=%d)",
- ae->worker->name,
- op->recoverable ? "" : "un",
- ae->last_errno);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "(%s) failed sending request (%srecoverable) "
+ "(errno=%d)",
+ ae->worker->name,
+ op->recoverable ? "" : "un",
+ ae->last_errno);
JK_TRACE_EXIT(l);
return JK_FATAL_ERROR;
}
@@ -1705,26 +1700,26 @@ static int ajp_send_request(jk_endpoint_t *e,
*/
if (err_conn + err_cping + err_send > 0)
if (err_cping + err_send > 0)
- jk_log(l, JK_LOG_INFO,
- "(%s) no usable connection found, will create a new one, "
- "detected by connect check (%d), cping (%d), send (%d).",
- ae->worker->name, err_conn, err_cping, err_send);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "(%s) no usable connection found, will create a new one, "
+ "detected by connect check (%d), cping (%d), send (%d).",
+ ae->worker->name, err_conn, err_cping, err_send);
else
- jk_log(l, JK_LOG_DEBUG,
- "(%s) no usable connection found, will create a new one, "
- "detected by connect check (%d), cping (%d), send (%d).",
- ae->worker->name, err_conn, err_cping, err_send);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "(%s) no usable connection found, will create a new one, "
+ "detected by connect check (%d), cping (%d), send (%d).",
+ ae->worker->name, err_conn, err_cping, err_send);
else if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "(%s) no usable connection found, will create a new one.",
- ae->worker->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "(%s) no usable connection found, will create a new one.",
+ ae->worker->name);
/* Connect to the backend.
*/
- if (ajp_connect_to_endpoint(ae, l) != JK_TRUE) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) connecting to backend failed. Tomcat is probably not started "
- "or is listening on the wrong port (errno=%d)",
- ae->worker->name, ae->last_errno);
+ if (ajp_connect_to_endpoint(s, ae, l) != JK_TRUE) {
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) connecting to backend failed. Tomcat is probably not started "
+ "or is listening on the wrong port (errno=%d)",
+ ae->worker->name, ae->last_errno);
JK_TRACE_EXIT(l);
return JK_FATAL_ERROR;
}
@@ -1733,12 +1728,12 @@ static int ajp_send_request(jk_endpoint_t *e,
/* handle cping/cpong if prepost_timeout is set
* and we didn't already do a connect cping/cpong.
*/
- if (ajp_handle_cping_cpong(ae,
+ if (ajp_handle_cping_cpong(s, ae,
ae->worker->prepost_timeout, l) == JK_FALSE) {
- jk_log(l, JK_LOG_INFO,
- "(%s) failed sending request, "
- "socket %d prepost cping/cpong failure (errno=%d)",
- ae->worker->name, ae->sd, ae->last_errno);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "(%s) failed sending request, "
+ "socket %d prepost cping/cpong failure (errno=%d)",
+ ae->worker->name, ae->sd, ae->last_errno);
JK_TRACE_EXIT(l);
return JK_FATAL_ERROR;
}
@@ -1747,27 +1742,27 @@ static int ajp_send_request(jk_endpoint_t *e,
/* We've got a connected socket and the optional
* cping/cpong worked, so let's send the request now.
*/
- rc = ajp_connection_tcp_send_message(ae, op->request, l);
+ rc = ajp_connection_tcp_send_message(s, ae, op->request, l);
/* Error during sending the request.
*/
if (rc != JK_TRUE) {
if (rc == JK_FATAL_ERROR)
op->recoverable = JK_FALSE;
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed sending request on a fresh connection (%srecoverable), "
- "socket %d (errno=%d)",
- ae->worker->name, op->recoverable ? "" : "un",
- ae->sd, ae->last_errno);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed sending request on a fresh connection (%srecoverable), "
+ "socket %d (errno=%d)",
+ ae->worker->name, op->recoverable ? "" : "un",
+ ae->sd, ae->last_errno);
JK_TRACE_EXIT(l);
return JK_FATAL_ERROR;
}
ae->last_op = JK_AJP13_FORWARD_REQUEST;
}
else if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "(%s) Statistics about invalid connections: "
- "connect check (%d), cping (%d), send (%d)",
- ae->worker->name, err_conn, err_cping, err_send);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "(%s) Statistics about invalid connections: "
+ "connect check (%d), cping (%d), send (%d)",
+ ae->worker->name, err_conn, err_cping, err_send);
/*
* From now on an error means that we have an internal server error
@@ -1775,11 +1770,11 @@ static int ajp_send_request(jk_endpoint_t *e,
*/
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "(%s) request body to send %" JK_UINT64_T_FMT
- " - request body to resend %d",
- ae->worker->name, ae->left_bytes_to_send,
- op->post->len > AJP_HEADER_LEN ? op->post->len - AJP_HEADER_LEN : 0);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "(%s) request body to send %" JK_UINT64_T_FMT
+ " - request body to resend %d",
+ ae->worker->name, ae->left_bytes_to_send,
+ op->post->len > AJP_HEADER_LEN ? op->post->len - AJP_HEADER_LEN : 0);
/*
* POST recovery job is done here and will work when data to
@@ -1791,24 +1786,24 @@ static int ajp_send_request(jk_endpoint_t *e,
*/
postlen = op->post->len;
if (postlen > AJP_HEADER_LEN) {
- rc = ajp_connection_tcp_send_message(ae, op->post, l);
+ rc = ajp_connection_tcp_send_message(s, ae, op->post, l);
/* Error during sending the request body.
*/
if (rc != JK_TRUE) {
if (rc == JK_FATAL_ERROR)
op->recoverable = JK_FALSE;
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed sending request body of size %d "
- "(%srecoverable), socket %d (errno=%d)",
- ae->worker->name, postlen, op->recoverable ? "" : "un",
- ae->sd, ae->last_errno);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed sending request body of size %d "
+ "(%srecoverable), socket %d (errno=%d)",
+ ae->worker->name, postlen, op->recoverable ? "" : "un",
+ ae->sd, ae->last_errno);
JK_TRACE_EXIT(l);
return JK_FATAL_ERROR;
}
else {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG, "(%s) Resent the request body (%d)",
- ae->worker->name, postlen);
+ jk_request_log(s, l, JK_LOG_DEBUG, "(%s) Resent the request body (%d)",
+ ae->worker->name, postlen);
}
}
else if (s->reco_status == RECO_FILLED) {
@@ -1817,26 +1812,26 @@ static int ajp_send_request(jk_endpoint_t *e,
postlen = s->reco_buf->len;
if (postlen > AJP_HEADER_LEN) {
- rc = ajp_connection_tcp_send_message(ae, s->reco_buf, l);
+ rc = ajp_connection_tcp_send_message(s, ae, s->reco_buf, l);
/* Error during sending the request body.
*/
if (rc != JK_TRUE) {
if (rc == JK_FATAL_ERROR)
op->recoverable = JK_FALSE;
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed sending request body of size %d (lb mode) "
- "(%srecoverable), socket %d (errno=%d)",
- ae->worker->name, postlen, op->recoverable ? "" : "un",
- ae->sd, ae->last_errno);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed sending request body of size %d (lb mode) "
+ "(%srecoverable), socket %d (errno=%d)",
+ ae->worker->name, postlen, op->recoverable ? "" : "un",
+ ae->sd, ae->last_errno);
JK_TRACE_EXIT(l);
return JK_FATAL_ERROR;
}
}
else {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "(%s) Resent the request body (lb mode) (%d)",
- ae->worker->name, postlen);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "(%s) Resent the request body (lb mode) (%d)",
+ ae->worker->name, postlen);
}
}
else {
@@ -1856,9 +1851,9 @@ static int ajp_send_request(jk_endpoint_t *e,
int len;
if ((len = ajp_read_into_msg_buff(ae, s, op->post, -1, l)) <= 0) {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "(%s) browser stop sending data, no need to recover",
- ae->worker->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "(%s) browser stop sending data, no need to recover",
+ ae->worker->name);
op->recoverable = JK_FALSE;
/* Send an empty POST message since per AJP protocol
* spec whenever we have content length the message
@@ -1867,7 +1862,7 @@ static int ajp_send_request(jk_endpoint_t *e,
*/
jk_b_reset(op->post);
jk_b_append_int(op->post, 0);
- ajp_connection_tcp_send_message(ae, op->post, l);
+ ajp_connection_tcp_send_message(s, ae, op->post, l);
JK_TRACE_EXIT(l);
return JK_CLIENT_RD_ERROR;
}
@@ -1879,22 +1874,22 @@ static int ajp_send_request(jk_endpoint_t *e,
s->reco_status = RECO_FILLED;
}
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "(%s) sending %d bytes of request body",
- ae->worker->name, len);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "(%s) sending %d bytes of request body",
+ ae->worker->name, len);
s->content_read = (jk_uint64_t)len;
- rc = ajp_connection_tcp_send_message(ae, op->post, l);
+ rc = ajp_connection_tcp_send_message(s, ae, op->post, l);
/* Error during sending the request body.
*/
if (rc != JK_TRUE) {
if (rc == JK_FATAL_ERROR)
op->recoverable = JK_FALSE;
- jk_log(l, JK_LOG_ERROR,
- "(%s) failed sending request body of size %d "
- "(%srecoverable), socket %d (errno=%d)",
- ae->worker->name, len, op->recoverable ? "" : "un",
- ae->sd, ae->last_errno);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) failed sending request body of size %d "
+ "(%srecoverable), socket %d (errno=%d)",
+ ae->worker->name, len, op->recoverable ? "" : "un",
+ ae->sd, ae->last_errno);
JK_TRACE_EXIT(l);
return JK_FATAL_ERROR;
}
@@ -1927,15 +1922,15 @@ static int ajp_process_callback(jk_msg_buf_t *msg,
* Backend already send us the headers.
*/
if (JK_IS_DEBUG_LEVEL(l)) {
- jk_log(l, JK_LOG_DEBUG,
- "(%s) Already received AJP13_SEND HEADERS", ae->worker->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "(%s) Already received AJP13_SEND HEADERS", ae->worker->name);
}
JK_TRACE_EXIT(l);
return JK_AJP13_ERROR;
}
if (!ajp_unmarshal_response(msg, &res, ae, l)) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) ajp_unmarshal_response failed", ae->worker->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) ajp_unmarshal_response failed", ae->worker->name);
JK_TRACE_EXIT(l);
return JK_AJP13_ERROR;
}
@@ -1943,9 +1938,9 @@ static int ajp_process_callback(jk_msg_buf_t *msg,
char **old_names = res.header_names;
char **old_values = res.header_values;
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG, "(%s) Adding %d response headers to %d "
- "headers received from tomcat",
- ae->worker->name, s->num_resp_headers, res.num_headers);
+ jk_request_log(s, l, JK_LOG_DEBUG, "(%s) Adding %d response headers to %d "
+ "headers received from tomcat",
+ ae->worker->name, s->num_resp_headers, res.num_headers);
res.header_names = jk_pool_alloc(s->pool,
(s->num_resp_headers + res.num_headers) *
sizeof(char *));
@@ -1953,9 +1948,9 @@ static int ajp_process_callback(jk_msg_buf_t *msg,
(s->num_resp_headers + res.num_headers) *
sizeof(char *));
if (!res.header_names || !res.header_values) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) Failed allocating one %d response headers.",
- ae->worker->name, s->num_resp_headers + res.num_headers);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) Failed allocating one %d response headers.",
+ ae->worker->name, s->num_resp_headers + res.num_headers);
res.header_names = old_names;
res.header_values = old_values;
} else {
@@ -2019,18 +2014,18 @@ static int ajp_process_callback(jk_msg_buf_t *msg,
* Reportedly some versions of JBoss suffer from that problem.
*/
if (jk_b_get_int(msg) == 0) {
- jk_log(l, JK_LOG_DEBUG,
- "(%s) Ignoring flush message received while sending the request",
- ae->worker->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "(%s) Ignoring flush message received while sending the request",
+ ae->worker->name);
return ae->last_op;
}
/* We have just send a request but received something
* that probably originates from buffered response.
*/
if (JK_IS_DEBUG_LEVEL(l)) {
- jk_log(l, JK_LOG_DEBUG,
- "(%s) Unexpected AJP13_SEND_BODY_CHUNK",
- ae->worker->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "(%s) Unexpected AJP13_SEND_BODY_CHUNK",
+ ae->worker->name);
}
JK_TRACE_EXIT(l);
return JK_AJP13_ERROR;
@@ -2047,9 +2042,9 @@ static int ajp_process_callback(jk_msg_buf_t *msg,
* the message is the chunk.
*/
if (len > (unsigned int)(msg->len - 3)) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) Chunk length too large. Length of AJP message is %d,"
- " chunk length is %d.", ae->worker->name, msg->len, len);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) Chunk length too large. Length of AJP message is %d,"
+ " chunk length is %d.", ae->worker->name, msg->len, len);
JK_TRACE_EXIT(l);
return JK_INTERNAL_ERROR;
}
@@ -2063,16 +2058,16 @@ static int ajp_process_callback(jk_msg_buf_t *msg,
}
}
else {
- jk_log(l, JK_LOG_DEBUG,
- "(%s) Ignoring flush message received before headers",
- ae->worker->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "(%s) Ignoring flush message received before headers",
+ ae->worker->name);
}
}
else {
if (!s->write(s, msg->buf + msg->pos, len)) {
- jk_log(l, JK_LOG_INFO,
- "(%s) Writing to client aborted or client network problems",
- ae->worker->name);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "(%s) Writing to client aborted or client network problems",
+ ae->worker->name);
JK_TRACE_EXIT(l);
return JK_CLIENT_WR_ERROR;
}
@@ -2098,9 +2093,9 @@ static int ajp_process_callback(jk_msg_buf_t *msg,
return JK_AJP13_HAS_RESPONSE;
}
- jk_log(l, JK_LOG_INFO,
- "(%s) Reading from client aborted or client network problems",
- ae->worker->name);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "(%s) Reading from client aborted or client network problems",
+ ae->worker->name);
JK_TRACE_EXIT(l);
return JK_CLIENT_RD_ERROR;
@@ -2114,13 +2109,13 @@ static int ajp_process_callback(jk_msg_buf_t *msg,
* AJP13 protocol reuse flag set to false.
* Tomcat will close its side of the connection.
*/
- jk_log(l, JK_LOG_WARNING, "(%s) AJP13 protocol: Reuse is set to false",
- ae->worker->name);
+ jk_request_log(s, l, JK_LOG_WARNING, "(%s) AJP13 protocol: Reuse is set to false",
+ ae->worker->name);
}
else if (s->disable_reuse) {
if (JK_IS_DEBUG_LEVEL(l)) {
- jk_log(l, JK_LOG_DEBUG, "(%s) AJP13 protocol: Reuse is disabled",
- ae->worker->name);
+ jk_request_log(s, l, JK_LOG_DEBUG, "(%s) AJP13 protocol: Reuse is disabled",
+ ae->worker->name);
}
ae->reuse = JK_FALSE;
}
@@ -2128,8 +2123,8 @@ static int ajp_process_callback(jk_msg_buf_t *msg,
/* Reuse in all cases
*/
if (JK_IS_DEBUG_LEVEL(l)) {
- jk_log(l, JK_LOG_DEBUG, "(%s) AJP13 protocol: Reuse is OK",
- ae->worker->name);
+ jk_request_log(s, l, JK_LOG_DEBUG, "(%s) AJP13 protocol: Reuse is OK",
+ ae->worker->name);
}
ae->reuse = JK_TRUE;
}
@@ -2150,8 +2145,8 @@ static int ajp_process_callback(jk_msg_buf_t *msg,
break;
default:
- jk_log(l, JK_LOG_ERROR,
- "(%s) Unknown AJP protocol code: %02X", ae->worker->name, code);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) Unknown AJP protocol code: %02X", ae->worker->name, code);
JK_TRACE_EXIT(l);
return JK_AJP13_ERROR;
}
@@ -2215,10 +2210,10 @@ static int ajp_get_reply(jk_endpoint_t *e,
if (jk_is_input_event(p->sd, reply_timeout, l) ==
JK_FALSE) {
p->last_errno = errno;
- jk_log(l, JK_LOG_ERROR,
- "(%s) Timeout with waiting reply from tomcat. "
- "Tomcat is down, stopped or network problems (errno=%d)",
- p->worker->name, p->last_errno);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) Timeout with waiting reply from tomcat. "
+ "Tomcat is down, stopped or network problems (errno=%d)",
+ p->worker->name, p->last_errno);
/* We can't trust this connection any more.
*/
ajp_abort_endpoint(p, JK_TRUE, l);
@@ -2250,12 +2245,12 @@ static int ajp_get_reply(jk_endpoint_t *e,
}
}
- if ((rc = ajp_connection_tcp_get_message(p, op->reply, l)) != JK_TRUE) {
+ if ((rc = ajp_connection_tcp_get_message(s, p, op->reply, l)) != JK_TRUE) {
if (headeratclient == JK_FALSE) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) Tomcat is down or refused connection. "
- "No response has been sent to the client (yet)",
- p->worker->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) Tomcat is down or refused connection. "
+ "No response has been sent to the client (yet)",
+ p->worker->name);
/*
* communication with tomcat has been interrupted BEFORE
* headers have been sent to the client.
@@ -2282,10 +2277,10 @@ static int ajp_get_reply(jk_endpoint_t *e,
}
else {
- jk_log(l, JK_LOG_ERROR,
- "(%s) Tomcat is down or network problems. "
- "Part of the response has already been sent to the client",
- p->worker->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) Tomcat is down or network problems. "
+ "Part of the response has already been sent to the client",
+ p->worker->name);
/* communication with tomcat has been interrupted AFTER
* headers have been sent to the client.
@@ -2323,21 +2318,21 @@ static int ajp_get_reply(jk_endpoint_t *e,
/* Backend send headers twice?
* This is protocol violation
*/
- jk_log(l, JK_LOG_ERROR,
- "(%s) Tomcat already send headers",
- p->worker->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) Tomcat already send headers",
+ p->worker->name);
op->recoverable = JK_FALSE;
JK_TRACE_EXIT(l);
return JK_FALSE;
}
}
if (JK_STATUS_ERROR == rc || JK_STATUS_FATAL_ERROR == rc) {
- jk_log(l, JK_LOG_INFO,
- "(%s) request failed%s, "
- "because of response status %d, ",
- p->worker->name,
- rc == JK_STATUS_FATAL_ERROR ? "" : " (soft)",
- s->http_response_status);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "(%s) request failed%s, "
+ "because of response status %d, ",
+ p->worker->name,
+ rc == JK_STATUS_FATAL_ERROR ? "" : " (soft)",
+ s->http_response_status);
JK_TRACE_EXIT(l);
return rc;
}
@@ -2352,11 +2347,11 @@ static int ajp_get_reply(jk_endpoint_t *e,
* data to file and replay for it
*/
op->recoverable = JK_FALSE;
- rc = ajp_connection_tcp_send_message(p, op->post, l);
+ rc = ajp_connection_tcp_send_message(s, p, op->post, l);
if (rc != JK_TRUE) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) Tomcat is down or network problems",
- p->worker->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) Tomcat is down or network problems",
+ p->worker->name);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -2401,9 +2396,9 @@ static int ajp_get_reply(jk_endpoint_t *e,
}
if (rc < 0) {
op->recoverable = JK_FALSE;
- jk_log(l, JK_LOG_ERROR,
- "(%s) Callback returns with unknown value %d",
- p->worker->name, rc);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) Callback returns with unknown value %d",
+ p->worker->name, rc);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -2515,14 +2510,14 @@ static int JK_METHOD ajp_service(jk_endpoint_t *e,
op->request = jk_b_new(&(p->pool));
if (!op->request) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) Failed allocating AJP message", aw->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) Failed allocating AJP request message", aw->name);
JK_TRACE_EXIT(l);
return JK_SERVER_ERROR;
}
if (jk_b_set_buffer_size(op->request, aw->max_packet_size)) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) Failed allocating AJP message buffer", aw->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) Failed allocating AJP request message buffer", aw->name);
JK_TRACE_EXIT(l);
return JK_SERVER_ERROR;
}
@@ -2530,28 +2525,28 @@ static int JK_METHOD ajp_service(jk_endpoint_t *e,
op->reply = jk_b_new(&(p->pool));
if (!op->reply) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) Failed allocating AJP message", aw->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) Failed allocating AJP reply message", aw->name);
JK_TRACE_EXIT(l);
return JK_SERVER_ERROR;
}
if (jk_b_set_buffer_size(op->reply, aw->max_packet_size)) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) Failed allocating AJP message buffer", aw->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) Failed allocating AJP reply message buffer", aw->name);
JK_TRACE_EXIT(l);
return JK_SERVER_ERROR;
}
op->post = jk_b_new(&(p->pool));
if (!op->post) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) Failed allocating AJP message", aw->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) Failed allocating AJP post message", aw->name);
JK_TRACE_EXIT(l);
return JK_SERVER_ERROR;
}
if (jk_b_set_buffer_size(op->post, aw->max_packet_size)) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) Failed allocating AJP message buffer", aw->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) Failed allocating AJP post message buffer", aw->name);
JK_TRACE_EXIT(l);
return JK_SERVER_ERROR;
}
@@ -2575,17 +2570,17 @@ static int JK_METHOD ajp_service(jk_endpoint_t *e,
*/
if (!ajp_marshal_into_msgb(op->request, s, l, p)) {
*is_error = JK_HTTP_REQUEST_TOO_LARGE;
- jk_log(l, JK_LOG_INFO,
- "(%s) Creating AJP message failed "
- "without recovery - check max_packet_size", aw->name);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "(%s) Creating AJP message failed "
+ "without recovery - check max_packet_size", aw->name);
aw->s->client_errors++;
JK_TRACE_EXIT(l);
return JK_CLIENT_ERROR;
}
if (JK_IS_DEBUG_LEVEL(l)) {
- jk_log(l, JK_LOG_DEBUG, "processing %s with %d retries",
- aw->name, aw->retries);
+ jk_request_log(s, l, JK_LOG_DEBUG, "processing %s with %d retries",
+ aw->name, aw->retries);
}
busy = JK_ATOMIC_INCREMENT(&(aw->s->busy));
if (aw->busy_limit > 0 && busy > aw->busy_limit) {
@@ -2595,10 +2590,10 @@ static int JK_METHOD ajp_service(jk_endpoint_t *e,
aw->s->error_time = time(NULL);
*is_error = JK_HTTP_SERVER_BUSY;
rc = JK_BUSY_ERROR;
- jk_log(l, JK_LOG_ERROR,
- "(%s) sending request to tomcat failed (recoverable), "
- "busy limit %d reached (rc=%d, errors=%d, client_errors=%d).",
- aw->name, aw->busy_limit, rc, aw->s->errors, aw->s->client_errors);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) sending request to tomcat failed (recoverable), "
+ "busy limit %d reached (rc=%d, errors=%d, client_errors=%d).",
+ aw->name, aw->busy_limit, rc, aw->s->errors, aw->s->client_errors);
JK_TRACE_EXIT(l);
return rc;
}
@@ -2620,9 +2615,9 @@ static int JK_METHOD ajp_service(jk_endpoint_t *e,
*/
if (i > 0 && retry_interval >= 0) {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "(%s) retry %d, sleeping for %d ms before retrying",
- aw->name, i, retry_interval);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "(%s) retry %d, sleeping for %d ms before retrying",
+ aw->name, i, retry_interval);
jk_sleep(retry_interval);
/* Pull shared memory if something changed during sleep
*/
@@ -2759,25 +2754,25 @@ static int JK_METHOD ajp_service(jk_endpoint_t *e,
*is_error = JK_HTTP_SERVER_ERROR;
msg = "because of an unknown reason";
rc = JK_FATAL_ERROR;
- jk_log(l, JK_LOG_ERROR,
- "(%s) unexpected condition err=%d (%srecoverable)",
- aw->name, err, op->recoverable ? "" : "un");
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) unexpected condition err=%d (%srecoverable)",
+ aw->name, err, op->recoverable ? "" : "un");
}
if (!op->recoverable && log_error == JK_TRUE) {
- jk_log(l, JK_LOG_ERROR,
- "(%s) sending request to tomcat failed (unrecoverable), "
- "%s "
- "(attempt=%d)",
- aw->name, msg, i + 1);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) sending request to tomcat failed (unrecoverable), "
+ "%s "
+ "(attempt=%d)",
+ aw->name, msg, i + 1);
}
else {
- jk_log(l, JK_LOG_INFO,
- "(%s) sending request to tomcat failed (%srecoverable), "
- "%s "
- "(attempt=%d)",
- aw->name,
- op->recoverable ? "" : "un",
- msg, i + 1);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "(%s) sending request to tomcat failed (%srecoverable), "
+ "%s "
+ "(attempt=%d)",
+ aw->name,
+ op->recoverable ? "" : "un",
+ msg, i + 1);
}
if (!op->recoverable) {
ajp_update_stats(e, aw, rc, l);
@@ -2792,9 +2787,9 @@ static int JK_METHOD ajp_service(jk_endpoint_t *e,
ajp_update_stats(e, aw, rc, l);
/* Log the error only once per failed request.
*/
- jk_log(l, JK_LOG_ERROR,
- "(%s) connecting to tomcat failed (rc=%d, errors=%d, client_errors=%d).",
- aw->name, rc, aw->s->errors, aw->s->client_errors);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "(%s) connecting to tomcat failed (rc=%d, errors=%d, client_errors=%d).",
+ aw->name, rc, aw->s->errors, aw->s->client_errors);
JK_TRACE_EXIT(l);
return rc;
@@ -3458,7 +3453,7 @@ int JK_METHOD ajp_maintain(jk_worker_t *pThis, time_t mstarted, int global, jk_l
k++;
/* handle cping/cpong.
*/
- if (ajp_handle_cping_cpong(aw->ep_cache[i],
+ if (ajp_handle_cping_cpong(NULL, aw->ep_cache[i],
aw->ping_timeout, l) == JK_FALSE) {
jk_log(l, JK_LOG_INFO,
"(%s) failed sending request, "
diff --git a/native/common/jk_ajp_common.h b/native/common/jk_ajp_common.h
index 52e653bb3..4581d57d8 100644
--- a/native/common/jk_ajp_common.h
+++ b/native/common/jk_ajp_common.h
@@ -463,7 +463,7 @@ int JK_METHOD ajp_done(jk_endpoint_t **e, jk_logger_t *l);
int ajp_get_endpoint(jk_worker_t *pThis,
jk_endpoint_t **pend, jk_logger_t *l, int proto);
-int ajp_connect_to_endpoint(ajp_endpoint_t * ae, jk_logger_t *l);
+int ajp_connect_to_endpoint(jk_ws_service_t *s, ajp_endpoint_t * ae, jk_logger_t *l);
void ajp_close_endpoint(ajp_endpoint_t * ae, jk_logger_t *l);
@@ -471,10 +471,10 @@ void jk_ajp_pull(ajp_worker_t * aw, int locked, jk_logger_t *l);
void jk_ajp_push(ajp_worker_t * aw, int locked, jk_logger_t *l);
-int ajp_connection_tcp_send_message(ajp_endpoint_t * ae,
+int ajp_connection_tcp_send_message(jk_ws_service_t *s, ajp_endpoint_t * ae,
jk_msg_buf_t *msg, jk_logger_t *l);
-int ajp_connection_tcp_get_message(ajp_endpoint_t * ae,
+int ajp_connection_tcp_get_message(jk_ws_service_t *s, ajp_endpoint_t * ae,
jk_msg_buf_t *msg, jk_logger_t *l);
int JK_METHOD ajp_maintain(jk_worker_t *pThis, time_t now, int global, jk_logger_t *l);
diff --git a/native/common/jk_lb_worker.c b/native/common/jk_lb_worker.c
index c2ec16db4..4c2882a83 100644
--- a/native/common/jk_lb_worker.c
+++ b/native/common/jk_lb_worker.c
@@ -561,8 +561,8 @@ static char *get_sessionid(jk_ws_service_t *s, lb_worker_t *p, jk_logger_t *l)
* However we should probably return 400
* (BAD_REQUEST) in this case
*/
- jk_log(l, JK_LOG_INFO,
- "Detected empty session identifier.");
+ jk_request_log(s, l, JK_LOG_INFO,
+ "Detected empty session identifier.");
return NULL;
}
return val;
@@ -1063,7 +1063,7 @@ static int get_most_suitable_worker(jk_ws_service_t *s,
}
if (p->lblock == JK_LB_LOCK_PESSIMISTIC) {
if (!jk_shm_lock()) {
- jk_log(l, JK_LOG_ERROR, "locking failed (errno=%d)", errno);
+ jk_request_log(s, l, JK_LOG_ERROR, "locking failed (errno=%d)", errno);
JK_TRACE_EXIT(l);
return -1;
}
@@ -1079,17 +1079,17 @@ static int get_most_suitable_worker(jk_ws_service_t *s,
if (next)
*next++ = '\0';
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "searching worker for partial sessionid %s",
- sessionid);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "searching worker for partial sessionid %s",
+ sessionid);
session_route = strchr(sessionid, '.');
if (session_route) {
++session_route;
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "searching worker for session route %s",
- session_route);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "searching worker for session route %s",
+ session_route);
/* We have a session route. Whow! */
rc = find_bysession_route(s, p, session_route, states, l);
@@ -1102,9 +1102,9 @@ static int get_most_suitable_worker(jk_ws_service_t *s,
JK_LEAVE_CS(&p->cs);
}
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "found worker %s (%s) for route %s and partial sessionid %s",
- wr->name, wr->route, session_route, sessionid);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "found worker %s (%s) for route %s and partial sessionid %s",
+ wr->name, wr->route, session_route, sessionid);
JK_TRACE_EXIT(l);
return rc;
}
@@ -1120,9 +1120,9 @@ static int get_most_suitable_worker(jk_ws_service_t *s,
else {
JK_LEAVE_CS(&p->cs);
}
- jk_log(l, JK_LOG_INFO,
- "all workers are in error state for session %s",
- session);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "all workers are in error state for session %s",
+ session);
JK_TRACE_EXIT(l);
return -1;
}
@@ -1137,9 +1137,9 @@ static int get_most_suitable_worker(jk_ws_service_t *s,
if (rc >= 0) {
lb_sub_worker_t *wr = &(p->lb_workers[rc]);
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "found best worker %s (%s) using method '%s'",
- wr->name, wr->route, jk_lb_get_method(p, l));
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "found best worker %s (%s) using method '%s'",
+ wr->name, wr->route, jk_lb_get_method(p, l));
JK_TRACE_EXIT(l);
return rc;
}
@@ -1231,16 +1231,17 @@ static int JK_METHOD service(jk_endpoint_t *e,
for (i = 0; i < num_of_workers; i++) {
lb_sub_worker_t *rec;
ajp_worker_t *aw;
- jk_log(l, JK_LOG_DEBUG, "LB - num_of_workers: %d, retry: %d, lb_retries: %d", num_of_workers, i, p->worker->lb_retries);
+ jk_request_log(s, l, JK_LOG_DEBUG, "LB - num_of_workers: %d, retry: %d, lb_retries: %d",
+ num_of_workers, i, p->worker->lb_retries);
rec = &(p->worker->lb_workers[i]);
aw = (ajp_worker_t *)rec->worker->worker_private;
if (rec->s->state == JK_LB_STATE_BUSY) {
if ((aw->busy_limit <= 0 || aw->s->busy < aw->busy_limit) &&
ajp_has_endpoint(rec->worker, l)) {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "worker %s busy state ended",
- rec->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "worker %s busy state ended",
+ rec->name);
rec->s->state = JK_LB_STATE_OK;
}
}
@@ -1252,15 +1253,16 @@ static int JK_METHOD service(jk_endpoint_t *e,
s->reco_buf = jk_b_new(s->pool);
if (!s->reco_buf) {
*is_error = JK_HTTP_SERVER_ERROR;
- jk_log(l, JK_LOG_ERROR,
- "Failed allocating AJP message");
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "Failed allocating AJP message");
JK_TRACE_EXIT(l);
return JK_SERVER_ERROR;
}
if (jk_b_set_buffer_size(s->reco_buf, p->worker->max_packet_size)) {
*is_error = JK_HTTP_SERVER_ERROR;
- jk_log(l, JK_LOG_ERROR,
- "Failed allocating AJP message buffer of %d bytes.", p->worker->max_packet_size);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "Failed allocating AJP message buffer of %d bytes.",
+ p->worker->max_packet_size);
JK_TRACE_EXIT(l);
return JK_SERVER_ERROR;
}
@@ -1274,14 +1276,14 @@ static int JK_METHOD service(jk_endpoint_t *e,
sessionid = get_sessionid(s, p->worker, l);
}
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "service sticky_session=%d id='%s'",
- p->worker->sticky_session, sessionid ? sessionid : "empty");
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "service sticky_session=%d id='%s'",
+ p->worker->sticky_session, sessionid ? sessionid : "empty");
while (recoverable == JK_TRUE) {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG, "attempt %d, max attempts %d, worker count %d",
- attempt, p->worker->lb_retries, num_of_workers);
+ jk_request_log(s, l, JK_LOG_DEBUG, "attempt %d, max attempts %d, worker count %d",
+ attempt, p->worker->lb_retries, num_of_workers);
if (attempt >= num_of_workers || attempt >= p->worker->lb_retries) {
retry++;
if (retry >= p->worker->retries) {
@@ -1289,9 +1291,9 @@ static int JK_METHOD service(jk_endpoint_t *e,
break;
}
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "retry %d, sleeping for %d ms before retrying",
- retry, p->worker->retry_interval);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "retry %d, sleeping for %d ms before retrying",
+ retry, p->worker->retry_interval);
jk_sleep(p->worker->retry_interval);
/* Pull shared memory if something changed during sleep */
if (p->worker->sequence < p->worker->s->h.sequence)
@@ -1322,9 +1324,9 @@ static int JK_METHOD service(jk_endpoint_t *e,
prec = rec;
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "service worker=%s route=%s failover=%s",
- rec->name, s->route, s->sticky ? "false" : "true");
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "service worker=%s route=%s failover=%s",
+ rec->name, s->route, s->sticky ? "false" : "true");
if (p->worker->lblock == JK_LB_LOCK_PESSIMISTIC)
jk_shm_lock();
@@ -1350,9 +1352,9 @@ static int JK_METHOD service(jk_endpoint_t *e,
}
if (p->worker->lblock == JK_LB_LOCK_PESSIMISTIC)
jk_shm_unlock();
- jk_log(l, JK_LOG_INFO,
- "could not get free endpoint for worker %s (%d retries)",
- rec->name, retry);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "could not get free endpoint for worker %s (%d retries)",
+ rec->name, retry);
}
else {
int service_stat = JK_UNSET;
@@ -1387,8 +1389,8 @@ static int JK_METHOD service(jk_endpoint_t *e,
s->resp_headers_values = jk_pool_alloc(s->pool,
(s->num_resp_headers + 1) * sizeof(char *));
if (!s->resp_headers_names || !s->resp_headers_values) {
- jk_log(l, JK_LOG_ERROR,
- "Failed allocating %d new response headers.", s->num_resp_headers + 1);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "Failed allocating %d new response headers.", s->num_resp_headers + 1);
s->resp_headers_names = old_names;
s->resp_headers_values = old_values;
} else if (s->num_resp_headers) {
@@ -1409,9 +1411,9 @@ static int JK_METHOD service(jk_endpoint_t *e,
(s->is_ssl ? ";Secure" : ""),
NULL);
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG, "Added cookie header '%s' with value '%s' ",
- s->resp_headers_names[s->num_resp_headers],
- s->resp_headers_values[s->num_resp_headers]);
+ jk_request_log(s, l, JK_LOG_DEBUG, "Added cookie header '%s' with value '%s' ",
+ s->resp_headers_names[s->num_resp_headers],
+ s->resp_headers_values[s->num_resp_headers]);
s->num_resp_headers++;
}
service_stat = end->service(end, s, l, &is_service_error);
@@ -1435,16 +1437,16 @@ static int JK_METHOD service(jk_endpoint_t *e,
else {
rec->s->lb_value = 0;
if (JK_IS_DEBUG_LEVEL(l)) {
- jk_log(l, JK_LOG_DEBUG,
- "worker %s has load value to low (%"
- JK_UINT64_T_FMT
- " < %"
- JK_UINT64_T_FMT
- ") ",
- "- correcting to 0",
- rec->name,
- rec->s->lb_value,
- rec->lb_mult);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "worker %s has load value to low (%"
+ JK_UINT64_T_FMT
+ " < %"
+ JK_UINT64_T_FMT
+ ") ",
+ "- correcting to 0",
+ rec->name,
+ rec->s->lb_value,
+ rec->lb_mult);
}
}
}
@@ -1582,9 +1584,9 @@ static int JK_METHOD service(jk_endpoint_t *e,
(rec->s->first_error_time > 0 &&
(int)difftime(now, rec->s->first_error_time) >= p->worker->error_escalation_time)) {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "worker %s escalating local error to global error",
- rec->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "worker %s escalating local error to global error",
+ rec->name);
rec->s->state = JK_LB_STATE_ERROR;
}
p->states[rec->i] = JK_LB_STATE_ERROR;
@@ -1597,10 +1599,10 @@ static int JK_METHOD service(jk_endpoint_t *e,
if (p->worker->lblock == JK_LB_LOCK_PESSIMISTIC)
jk_shm_unlock();
if (p->states[rec->i] == JK_LB_STATE_ERROR)
- jk_log(l, JK_LOG_INFO,
- "service failed, worker %s is in %serror state",
- rec->name,
- rec->s->state == JK_LB_STATE_ERROR ? "" : "local ");
+ jk_request_log(s, l, JK_LOG_INFO,
+ "service failed, worker %s is in %serror state",
+ rec->name,
+ rec->s->state == JK_LB_STATE_ERROR ? "" : "local ");
}
if (recoverable == JK_TRUE) {
/*
@@ -1608,25 +1610,25 @@ static int JK_METHOD service(jk_endpoint_t *e,
* another worker... Lets try to do that.
*/
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "recoverable error... will try to recover on other worker");
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "recoverable error... will try to recover on other worker");
}
else {
/*
* Error is not recoverable - break with an error.
*/
if (rc == JK_CLIENT_ERROR)
- jk_log(l, JK_LOG_INFO,
- "unrecoverable error %d, request failed."
- " Client failed in the middle of request,"
- " we can't recover to another instance.",
- *is_error);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "unrecoverable error %d, request failed."
+ " Client failed in the middle of request,"
+ " we can't recover to another instance.",
+ *is_error);
else if (rc != JK_TRUE)
- jk_log(l, JK_LOG_ERROR,
- "unrecoverable error %d, request failed."
- " Tomcat failed in the middle of request,"
- " we can't recover to another instance.",
- *is_error);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "unrecoverable error %d, request failed."
+ " Tomcat failed in the middle of request,"
+ " we can't recover to another instance.",
+ *is_error);
}
if (first == 1 && s->add_log_items) {
first = 0;
@@ -1649,27 +1651,27 @@ static int JK_METHOD service(jk_endpoint_t *e,
* Reset the service loop and go again
*/
prec = NULL;
- jk_log(l, JK_LOG_INFO,
- "Forcing recovery once for %d workers", nf);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "Forcing recovery once for %d workers", nf);
continue;
}
else {
/* No workers in error state.
* Somebody set them all to disabled?
*/
- jk_log(l, JK_LOG_INFO,
- "All tomcat instances failed, no more workers "
- "left for recovery (attempt=%d, retry=%d)",
- attempt + 1, retry);
+ jk_request_log(s,l, JK_LOG_INFO,
+ "All tomcat instances failed, no more workers "
+ "left for recovery (attempt=%d, retry=%d)",
+ attempt + 1, retry);
*is_error = JK_HTTP_SERVER_BUSY;
rc = JK_FALSE;
}
}
else {
- jk_log(l, JK_LOG_INFO,
- "All tomcat instances failed, no more workers "
- "left (attempt=%d, retry=%d)",
- attempt + 1, retry);
+ jk_request_log(s,l, JK_LOG_INFO,
+ "All tomcat instances failed, no more workers "
+ "left (attempt=%d, retry=%d)",
+ attempt + 1, retry);
*is_error = JK_HTTP_SERVER_BUSY;
rc = JK_FALSE;
}
@@ -1677,13 +1679,13 @@ static int JK_METHOD service(jk_endpoint_t *e,
attempt++;
}
if (recoverable == JK_TRUE) {
- jk_log(l, JK_LOG_INFO,
- "All tomcat instances are busy or in error state");
+ jk_request_log(s,l, JK_LOG_INFO,
+ "All tomcat instances are busy or in error state");
/* rc and http error must be set above */
}
if (rc == JK_FALSE) {
- jk_log(l, JK_LOG_ERROR,
- "All tomcat instances failed, no more workers left");
+ jk_request_log(s,l, JK_LOG_ERROR,
+ "All tomcat instances failed, no more workers left");
}
if (prec && s->add_log_items) {
lb_add_log_items(s, lb_last_log_names, prec, l);
diff --git a/native/common/jk_status.c b/native/common/jk_status.c
index 0ee9bbe5a..60a99af1a 100644
--- a/native/common/jk_status.c
+++ b/native/common/jk_status.c
@@ -550,8 +550,8 @@ static int jk_printf(jk_ws_service_t *s, jk_logger_t *l, const char *fmt, ...)
if (rc > 0 && rc < HUGE_BUFFER_SIZE)
s->write(s, buf, rc);
else
- jk_log(l, JK_LOG_WARNING,
- "Insufficient buffer size %d in status worker, some output was dropped", HUGE_BUFFER_SIZE);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Insufficient buffer size %d in status worker, some output was dropped", HUGE_BUFFER_SIZE);
return rc;
}
@@ -1305,18 +1305,18 @@ static int status_parse_uri(jk_ws_service_t *s,
if (!s->query_string) {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' query string is empty",
- w->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' query string is empty",
+ w->name);
JK_TRACE_EXIT(l);
return JK_TRUE;
}
p->query_string = jk_pool_strdup(s->pool, s->query_string);
if (!p->query_string) {
- jk_log(l, JK_LOG_ERROR,
- "Status worker '%s' could not copy query string",
- w->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "Status worker '%s' could not copy query string",
+ w->name);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -1327,9 +1327,9 @@ static int status_parse_uri(jk_ws_service_t *s,
query[0] = '@';
if (!jk_map_alloc(&(p->req_params))) {
- jk_log(l, JK_LOG_ERROR,
- "Status worker '%s' could not alloc map for request parameters",
- w->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "Status worker '%s' could not alloc map for request parameters",
+ w->name);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -1337,8 +1337,8 @@ static int status_parse_uri(jk_ws_service_t *s,
query = jk_pool_strdup(s->pool, p->query_string);
if (!query) {
- jk_log(l, JK_LOG_ERROR,
- "Status worker '%s' could not copy query string",
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "Status worker '%s' could not copy query string",
w->name);
JK_TRACE_EXIT(l);
return JK_FALSE;
@@ -1354,9 +1354,9 @@ static int status_parse_uri(jk_ws_service_t *s,
char *value;
char *tmp;
if (!key) {
- jk_log(l, JK_LOG_ERROR,
- "Status worker '%s' could not copy string",
- w->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "Status worker '%s' could not copy string",
+ w->name);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -1368,10 +1368,10 @@ static int status_parse_uri(jk_ws_service_t *s,
if (strlen(key)) {
/* percent decoding */
if (jk_unescape_url(value, value, -1, NULL, NULL, 1, NULL) != JK_TRUE) {
- jk_log(l, JK_LOG_ERROR,
- "Status worker '%s' could not decode query string "
- "param '%s' with value '%s'",
- w->name, key, value);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "Status worker '%s' could not decode query string "
+ "param '%s' with value '%s'",
+ w->name, key, value);
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -1383,9 +1383,9 @@ static int status_parse_uri(jk_ws_service_t *s,
tmp[0] = '@';
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' adding request param '%s' with value '%s'",
- w->name, key, value);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' adding request param '%s' with value '%s'",
+ w->name, key, value);
/* XXX Depending on the params values, we might need to trim */
jk_map_put(m, key, value, NULL);
}
@@ -1461,25 +1461,25 @@ static int check_valid_lb(jk_ws_service_t *s,
JK_TRACE_ENTER(l);
if (jw->type != JK_LB_WORKER_TYPE) {
if (implemented) {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' worker type of worker '%s' has no sub workers",
- w->name, worker);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' worker type of worker '%s' has no sub workers",
+ w->name, worker);
p->msg = "worker type has no sub workers";
}
else {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' worker type of worker '%s' not implemented",
- w->name, worker);
- p->msg = "worker type not implemented";
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' worker type of worker '%s' not implemented",
+ w->name, worker);
+ p->msg = "worker type not implemented";
}
JK_TRACE_EXIT(l);
return JK_FALSE;
}
*lbp = (lb_worker_t *)jw->worker_private;
if (!*lbp) {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' lb structure of worker '%s' is (null)",
- w->name, worker);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' lb structure of worker '%s' is (null)",
+ w->name, worker);
p->msg = "lb structure is (null)";
JK_TRACE_EXIT(l);
return JK_FALSE;
@@ -1500,22 +1500,22 @@ static int search_worker(jk_ws_service_t *s,
JK_TRACE_ENTER(l);
*jwp = NULL;
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' searching worker '%s'",
- w->name, worker ? worker : "(null)");
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' searching worker '%s'",
+ w->name, worker ? worker : "(null)");
if (!worker || !worker[0]) {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' NULL or EMPTY worker param",
- w->name);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' NULL or EMPTY worker param",
+ w->name);
p->msg = "NULL or EMPTY worker param";
JK_TRACE_EXIT(l);
return JK_FALSE;
}
*jwp = wc_get_worker_for_name(worker, l);
if (!*jwp) {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' could not find worker '%s'",
- w->name, worker);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' could not find worker '%s'",
+ w->name, worker);
p->msg = "Could not find given worker";
JK_TRACE_EXIT(l);
return JK_FALSE;
@@ -1541,14 +1541,14 @@ static int search_sub_worker(jk_ws_service_t *s,
JK_TRACE_ENTER(l);
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' searching sub worker '%s' of worker '%s'",
- w->name, sub_worker ? sub_worker : "(null)",
- worker ? worker : "(null)");
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' searching sub worker '%s' of worker '%s'",
+ w->name, sub_worker ? sub_worker : "(null)",
+ worker ? worker : "(null)");
if (!sub_worker || !sub_worker[0]) {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' NULL or EMPTY sub_worker param",
- w->name);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' NULL or EMPTY sub_worker param",
+ w->name);
p->msg = "NULL or EMPTY sub_worker param";
JK_TRACE_EXIT(l);
return JK_FALSE;
@@ -1572,9 +1572,9 @@ static int search_sub_worker(jk_ws_service_t *s,
}
*wrp = wr;
if (!wr || i == lb->num_of_workers) {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' could not find sub worker '%s' of worker '%s'",
- w->name, sub_worker, worker ? worker : "(null)");
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' could not find sub worker '%s' of worker '%s'",
+ w->name, sub_worker, worker ? worker : "(null)");
p->msg = "could not find sub worker";
JK_TRACE_EXIT(l);
return JK_FALSE;
@@ -1814,9 +1814,9 @@ static void display_maps(jk_ws_service_t *s,
}
}
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' displayed %d maps for worker '%s'",
- w->name, count, worker);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' displayed %d maps for worker '%s'",
+ w->name, count, worker);
JK_TRACE_EXIT(l);
}
@@ -2724,15 +2724,15 @@ static void display_worker(jk_ws_service_t *s,
lb_worker_t *lb = (lb_worker_t *)jw->worker_private;
if (lb) {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' %s lb worker '%s'",
- w->name, "displaying", lb->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' %s lb worker '%s'",
+ w->name, "displaying", lb->name);
display_worker_lb(s, p, lb, swr, l);
}
else {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' lb worker is (null)",
- w->name);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' lb worker is (null)",
+ w->name);
}
}
else if (jw->type == JK_AJP13_WORKER_TYPE ||
@@ -2740,22 +2740,22 @@ static void display_worker(jk_ws_service_t *s,
ajp_worker_t *aw = (ajp_worker_t *)jw->worker_private;
if (aw) {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' %s ajp worker '%s'",
- w->name, "displaying", aw->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' %s ajp worker '%s'",
+ w->name, "displaying", aw->name);
display_worker_ajp(s, p, aw, jw->type, l);
}
else {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' aw worker is (null)",
- w->name);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' aw worker is (null)",
+ w->name);
}
}
else {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' worker type not implemented",
- w->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' worker type not implemented",
+ w->name);
JK_TRACE_EXIT(l);
return;
}
@@ -2775,22 +2775,22 @@ static void form_worker(jk_ws_service_t *s,
lb = (lb_worker_t *)jw->worker_private;
name = lb->name;
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' producing edit form for lb worker '%s'",
- w->name, name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' producing edit form for lb worker '%s'",
+ w->name, name);
}
else {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' worker type not implemented",
- w->name);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' worker type not implemented",
+ w->name);
JK_TRACE_EXIT(l);
return;
}
if (!lb) {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' lb structure is (null)",
- w->name);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' lb structure is (null)",
+ w->name);
JK_TRACE_EXIT(l);
return;
}
@@ -2896,9 +2896,9 @@ static void form_member(jk_ws_service_t *s,
JK_TRACE_ENTER(l);
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' producing edit form for sub worker '%s' of lb worker '%s'",
- w->name, wr? wr->name : aw->name, lb_name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' producing edit form for sub worker '%s' of lb worker '%s'",
+ w->name, wr? wr->name : aw->name, lb_name);
jk_putv(s, "<hr/><h3>Edit worker settings for ",
wr? wr->name : aw->name, "</h3>\n", NULL);
@@ -3036,9 +3036,9 @@ static void form_all_members(jk_ws_service_t *s,
JK_TRACE_ENTER(l);
if (!attribute) {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' missing request parameter '%s'",
- w->name, JK_STATUS_ARG_ATTRIBUTE);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' missing request parameter '%s'",
+ w->name, JK_STATUS_ARG_ATTRIBUTE);
JK_TRACE_EXIT(l);
return;
}
@@ -3078,9 +3078,9 @@ static void form_all_members(jk_ws_service_t *s,
else if (!strcmp(attribute, JK_STATUS_ARG_AJP_MAX_PK_SZ))
aname=JK_STATUS_ARG_AJP_TEXT_MAX_PK_SZ;
else {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' unknown attribute '%s'",
- w->name, attribute);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' unknown attribute '%s'",
+ w->name, attribute);
JK_TRACE_EXIT(l);
return;
}
@@ -3089,14 +3089,14 @@ static void form_all_members(jk_ws_service_t *s,
lb = (lb_worker_t *)jw->worker_private;
name = lb->name;
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' producing edit form for attribute '%s' [%s] of all members of lb worker '%s'",
- w->name, attribute, aname, name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' producing edit form for attribute '%s' [%s] of all members of lb worker '%s'",
+ w->name, attribute, aname, name);
}
else {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' worker type not implemented",
- w->name);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' worker type not implemented",
+ w->name);
JK_TRACE_EXIT(l);
return;
}
@@ -3232,22 +3232,22 @@ static void commit_worker(jk_ws_service_t *s,
lb = (lb_worker_t *)jw->worker_private;
name = lb->name;
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' committing changes for lb worker '%s'",
- w->name, name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' committing changes for lb worker '%s'",
+ w->name, name);
}
else {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' worker type not implemented",
- w->name);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' worker type not implemented",
+ w->name);
JK_TRACE_EXIT(l);
return;
}
if (!lb) {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' lb structure is (null)",
- w->name);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' lb structure is (null)",
+ w->name);
JK_TRACE_EXIT(l);
return;
}
@@ -3255,70 +3255,70 @@ static void commit_worker(jk_ws_service_t *s,
i = status_get_int(p, JK_STATUS_ARG_LB_RETRIES,
lb->retries, l);
if (i != lb->retries && i > 0) {
- jk_log(l, JK_LOG_INFO,
- "Status worker '%s' changing 'retries' for lb worker '%s' from '%d' to '%d'",
- w->name, name, lb->retries, i);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "Status worker '%s' changing 'retries' for lb worker '%s' from '%d' to '%d'",
+ w->name, name, lb->retries, i);
lb->retries = i;
sync_needed = JK_TRUE;
}
i = status_get_int(p, JK_STATUS_ARG_LB_RETRY_INT,
lb->retry_interval, l);
if (i != lb->retry_interval && i > 0) {
- jk_log(l, JK_LOG_INFO,
- "Status worker '%s' changing 'retry_interval' for lb worker '%s' from '%d' to '%d'",
- w->name, name, lb->retry_interval, i);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "Status worker '%s' changing 'retry_interval' for lb worker '%s' from '%d' to '%d'",
+ w->name, name, lb->retry_interval, i);
lb->retry_interval = i;
sync_needed = JK_TRUE;
}
i = status_get_int(p, JK_STATUS_ARG_LB_RECOVER_TIME,
lb->recover_wait_time, l);
if (i != lb->recover_wait_time && i > 0) {
- jk_log(l, JK_LOG_INFO,
- "Status worker '%s' changing 'recover_time' for lb worker '%s' from '%d' to '%d'",
- w->name, name, lb->recover_wait_time, i);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "Status worker '%s' changing 'recover_time' for lb worker '%s' from '%d' to '%d'",
+ w->name, name, lb->recover_wait_time, i);
lb->recover_wait_time = i;
sync_needed = JK_TRUE;
}
i = status_get_int(p, JK_STATUS_ARG_LB_ERROR_ESCALATION_TIME,
lb->error_escalation_time, l);
if (i != lb->error_escalation_time && i > 0) {
- jk_log(l, JK_LOG_INFO,
- "Status worker '%s' changing 'error_escalation_time' for lb worker '%s' from '%d' to '%d'",
- w->name, name, lb->error_escalation_time, i);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "Status worker '%s' changing 'error_escalation_time' for lb worker '%s' from '%d' to '%d'",
+ w->name, name, lb->error_escalation_time, i);
lb->error_escalation_time = i;
sync_needed = JK_TRUE;
}
i = status_get_int(p, JK_STATUS_ARG_LB_MAX_REPLY_TIMEOUTS,
lb->max_reply_timeouts, l);
if (i != lb->max_reply_timeouts && i >= 0) {
- jk_log(l, JK_LOG_INFO,
- "Status worker '%s' changing 'max_reply_timeouts' for lb worker '%s' from '%d' to '%d'",
- w->name, name, lb->max_reply_timeouts, i);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "Status worker '%s' changing 'max_reply_timeouts' for lb worker '%s' from '%d' to '%d'",
+ w->name, name, lb->max_reply_timeouts, i);
lb->max_reply_timeouts = i;
sync_needed = JK_TRUE;
}
i = status_get_bool(p, JK_STATUS_ARG_LB_STICKY, lb->sticky_session, l);
if (i != lb->sticky_session) {
- jk_log(l, JK_LOG_INFO,
- "Status worker '%s' changing 'sticky_session' for lb worker '%s' from '%d' to '%d'",
- w->name, name, lb->sticky_session, i);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "Status worker '%s' changing 'sticky_session' for lb worker '%s' from '%d' to '%d'",
+ w->name, name, lb->sticky_session, i);
lb->sticky_session = i;
sync_needed = JK_TRUE;
}
i = status_get_bool(p, JK_STATUS_ARG_LB_STICKY_FORCE, lb->sticky_session_force, l);
if (i != lb->sticky_session_force) {
- jk_log(l, JK_LOG_INFO,
- "Status worker '%s' changing 'sticky_session_force' for lb worker '%s' from '%d' to '%d'",
- w->name, name, lb->sticky_session_force, i);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "Status worker '%s' changing 'sticky_session_force' for lb worker '%s' from '%d' to '%d'",
+ w->name, name, lb->sticky_session_force, i);
lb->sticky_session_force = i;
sync_needed = JK_TRUE;
}
if (status_get_string(p, JK_STATUS_ARG_LB_METHOD, NULL, &arg, l) == JK_TRUE) {
i = jk_lb_get_method_code(arg);
if (i != lb->lbmethod && i >= 0 && i <= JK_LB_METHOD_MAX) {
- jk_log(l, JK_LOG_INFO,
- "Status worker '%s' changing 'method' for lb worker '%s' from '%s' to '%s'",
- w->name, name, jk_lb_get_method(lb, l), jk_lb_get_method_direct(i, l));
+ jk_request_log(s, l, JK_LOG_INFO,
+ "Status worker '%s' changing 'method' for lb worker '%s' from '%s' to '%s'",
+ w->name, name, jk_lb_get_method(lb, l), jk_lb_get_method_direct(i, l));
lb->lbmethod = i;
sync_needed = JK_TRUE;
}
@@ -3326,9 +3326,9 @@ static void commit_worker(jk_ws_service_t *s,
if (status_get_string(p, JK_STATUS_ARG_LB_LOCK, NULL, &arg, l) == JK_TRUE) {
i = jk_lb_get_lock_code(arg);
if (i != lb->lblock && i >= 0 && i <= JK_LB_LOCK_MAX) {
- jk_log(l, JK_LOG_INFO,
- "Status worker '%s' changing 'lock' for lb worker '%s' from '%s' to '%s'",
- w->name, name, jk_lb_get_lock(lb, l), jk_lb_get_lock_direct(i, l));
+ jk_request_log(s, l, JK_LOG_INFO,
+ "Status worker '%s' changing 'lock' for lb worker '%s' from '%s' to '%s'",
+ w->name, name, jk_lb_get_lock(lb, l), jk_lb_get_lock_direct(i, l));
lb->lblock = i;
sync_needed = JK_TRUE;
}
@@ -3422,24 +3422,24 @@ static int commit_member(jk_ws_service_t *s,
if (lb) {
lb_name = lb->name;
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' committing changes for sub worker '%s' of lb worker '%s'",
- w->name, wr->name, lb_name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' committing changes for sub worker '%s' of lb worker '%s'",
+ w->name, wr->name, lb_name);
}
else {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' committing changes for ajp worker '%s'",
- w->name, aw->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' committing changes for ajp worker '%s'",
+ w->name, aw->name);
}
if (lb) {
if (status_get_string(p, JK_STATUS_ARG_LBM_ACTIVATION, NULL, &arg, l) == JK_TRUE) {
i = jk_lb_get_activation_code(arg);
if (i != wr->activation && i >= 0 && i <= JK_LB_ACTIVATION_MAX) {
- jk_log(l, JK_LOG_INFO,
- "Status worker '%s' changing 'activation' for sub worker '%s' of lb worker '%s' from '%s' to '%s'",
- w->name, wr->name, lb_name, jk_lb_get_activation(wr, l), jk_lb_get_activation_direct(i, l));
+ jk_request_log(s, l, JK_LOG_INFO,
+ "Status worker '%s' changing 'activation' for sub worker '%s' of lb worker '%s' from '%s' to '%s'",
+ w->name, wr->name, lb_name, jk_lb_get_activation(wr, l), jk_lb_get_activation_direct(i, l));
wr->activation = i;
*side_effect |= JK_STATUS_NEEDS_RESET_LB_VALUES | JK_STATUS_NEEDS_PUSH;
}
@@ -3459,9 +3459,9 @@ static int commit_member(jk_ws_service_t *s,
rc = JK_FALSE;
}
else if (strncmp(wr->route, arg, JK_SHM_STR_SIZ )) {
- jk_log(l, JK_LOG_INFO,
- "Status worker '%s' changing 'route' for sub worker '%s' of lb worker '%s' from '%s' to '%s'",
- w->name, wr->name, lb_name, wr->route, arg);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "Status worker '%s' changing 'route' for sub worker '%s' of lb worker '%s' from '%s' to '%s'",
+ w->name, wr->name, lb_name, wr->route, arg);
strncpy(wr->route, arg, JK_SHM_STR_SIZ );
*side_effect |= JK_STATUS_NEEDS_PUSH;
if (!wr->domain[0]) {
@@ -3485,9 +3485,9 @@ static int commit_member(jk_ws_service_t *s,
rc = JK_FALSE;
}
else if (strncmp(wr->redirect, arg, JK_SHM_STR_SIZ )) {
- jk_log(l, JK_LOG_INFO,
- "Status worker '%s' changing 'redirect' for sub worker '%s' of lb worker '%s' from '%s' to '%s'",
- w->name, wr->name, lb_name, wr->redirect, arg);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "Status worker '%s' changing 'redirect' for sub worker '%s' of lb worker '%s' from '%s' to '%s'",
+ w->name, wr->name, lb_name, wr->redirect, arg);
strncpy(wr->redirect, arg, JK_SHM_STR_SIZ );
*side_effect |= JK_STATUS_NEEDS_PUSH;
}
@@ -3503,9 +3503,9 @@ static int commit_member(jk_ws_service_t *s,
rc = JK_FALSE;
}
else if (strncmp(wr->domain, arg, JK_SHM_STR_SIZ )) {
- jk_log(l, JK_LOG_INFO,
- "Status worker '%s' changing 'domain' for sub worker '%s' of lb worker '%s' from '%s' to '%s'",
- w->name, wr->name, lb_name, wr->domain, arg);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "Status worker '%s' changing 'domain' for sub worker '%s' of lb worker '%s' from '%s' to '%s'",
+ w->name, wr->name, lb_name, wr->domain, arg);
strncpy(wr->domain, arg, JK_SHM_STR_SIZ);
*side_effect |= JK_STATUS_NEEDS_PUSH;
}
@@ -3544,9 +3544,9 @@ static int commit_member(jk_ws_service_t *s,
rc = JK_FALSE;
}
else if (strncmp(aw->host, arg, JK_SHM_STR_SIZ)) {
- jk_log(l, JK_LOG_INFO,
- "Status worker '%s' changing 'host' for sub worker '%s' from '%s' to '%s'",
- w->name, aw->name, aw->host, arg);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "Status worker '%s' changing 'host' for sub worker '%s' from '%s' to '%s'",
+ w->name, aw->name, aw->host, arg);
strncpy(host, arg, JK_SHM_STR_SIZ);
resolve = JK_TRUE;
}
@@ -3559,9 +3559,9 @@ static int commit_member(jk_ws_service_t *s,
size_t size = strlen(msg) + strlen(host) + strlen(aw->name) + 10 + 1;
p->msg = jk_pool_alloc(s->pool, size);
snprintf(p->msg, size, msg, host, port, aw->name);
- jk_log(l, JK_LOG_ERROR,
- "Status worker '%s' failed resolving address '%s:%d' for sub worker '%s'.",
- w->name, host, port, aw->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "Status worker '%s' failed resolving address '%s:%d' for sub worker '%s'.",
+ w->name, host, port, aw->name);
rc = JK_FALSE;
}
else {
@@ -3629,9 +3629,9 @@ static void commit_all_members(jk_ws_service_t *s,
JK_TRACE_ENTER(l);
if (!attribute) {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' missing request parameter '%s'",
- w->name, JK_STATUS_ARG_ATTRIBUTE);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' missing request parameter '%s'",
+ w->name, JK_STATUS_ARG_ATTRIBUTE);
JK_TRACE_EXIT(l);
return;
}
@@ -3671,9 +3671,9 @@ static void commit_all_members(jk_ws_service_t *s,
else if (!strcmp(attribute, JK_STATUS_ARG_AJP_MAX_PK_SZ))
aname=JK_STATUS_ARG_AJP_TEXT_MAX_PK_SZ;
else {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' unknown attribute '%s'",
- w->name, attribute);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' unknown attribute '%s'",
+ w->name, attribute);
JK_TRACE_EXIT(l);
return;
}
@@ -3682,14 +3682,14 @@ static void commit_all_members(jk_ws_service_t *s,
lb = (lb_worker_t *)jw->worker_private;
name = lb->name;
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' committing changes for attribute '%s' [%s] of all members of lb worker '%s'",
- w->name, attribute, aname, name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' committing changes for attribute '%s' [%s] of all members of lb worker '%s'",
+ w->name, attribute, aname, name);
}
else {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' worker type not implemented",
- w->name);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' worker type not implemented",
+ w->name);
JK_TRACE_EXIT(l);
return;
}
@@ -3790,9 +3790,9 @@ static void commit_all_members(jk_ws_service_t *s,
if (rv == JK_TRUE) {
i = jk_lb_get_activation_code(arg);
if (i != wr->activation && i >= 0 && i <= JK_LB_ACTIVATION_MAX) {
- jk_log(l, JK_LOG_INFO,
- "Status worker '%s' changing 'activation' for sub worker '%s' of lb worker '%s' from '%s' to '%s'",
- w->name, wr->name, name, jk_lb_get_activation(wr, l), jk_lb_get_activation_direct(i, l));
+ jk_request_log(s, l, JK_LOG_INFO,
+ "Status worker '%s' changing 'activation' for sub worker '%s' of lb worker '%s' from '%s' to '%s'",
+ w->name, wr->name, name, jk_lb_get_activation(wr, l), jk_lb_get_activation_direct(i, l));
wr->activation = i;
rc = 1;
sync_needed = JK_TRUE;
@@ -3810,9 +3810,9 @@ static void commit_all_members(jk_ws_service_t *s,
rc = JK_FALSE;
}
else if (strncmp(wr->route, arg, JK_SHM_STR_SIZ)) {
- jk_log(l, JK_LOG_INFO,
- "Status worker '%s' changing 'route' for sub worker '%s' of lb worker '%s' from '%s' to '%s'",
- w->name, wr->name, name, wr->route, arg);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "Status worker '%s' changing 'route' for sub worker '%s' of lb worker '%s' from '%s' to '%s'",
+ w->name, wr->name, name, wr->route, arg);
strncpy(wr->route, arg, JK_SHM_STR_SIZ);
sync_needed = JK_TRUE;
if (!wr->domain[0]) {
@@ -3837,9 +3837,9 @@ static void commit_all_members(jk_ws_service_t *s,
rc = JK_FALSE;
}
else if (strncmp(wr->redirect, arg, JK_SHM_STR_SIZ)) {
- jk_log(l, JK_LOG_INFO,
- "Status worker '%s' changing 'redirect' for sub worker '%s' of lb worker '%s' from '%s' to '%s'",
- w->name, wr->name, name, wr->redirect, arg);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "Status worker '%s' changing 'redirect' for sub worker '%s' of lb worker '%s' from '%s' to '%s'",
+ w->name, wr->name, name, wr->redirect, arg);
strncpy(wr->redirect, arg, JK_SHM_STR_SIZ);
sync_needed = JK_TRUE;
}
@@ -3856,9 +3856,9 @@ static void commit_all_members(jk_ws_service_t *s,
rc = JK_FALSE;
}
else if (strncmp(wr->domain, arg, JK_SHM_STR_SIZ)) {
- jk_log(l, JK_LOG_INFO,
- "Status worker '%s' changing 'domain' for sub worker '%s' of lb worker '%s' from '%s' to '%s'",
- w->name, wr->name, name, wr->domain, arg);
+ jk_request_log(s, l, JK_LOG_INFO,
+ "Status worker '%s' changing 'domain' for sub worker '%s' of lb worker '%s' from '%s' to '%s'",
+ w->name, wr->name, name, wr->domain, arg);
strncpy(wr->domain, arg, JK_SHM_STR_SIZ);
sync_needed = JK_TRUE;
}
@@ -3978,9 +3978,9 @@ static int check_worker(jk_ws_service_t *s,
if (strchr(sub_worker, '*') || strchr(sub_worker, '?')) {
/* We have a wildchar matching rule */
if (!allow_wildchars) {
- jk_log(l, JK_LOG_ERROR,
- "Status worker '%s' wildcards in sub worker '%s' of worker '%s' not allowed for this command",
- w->name, sub_worker, worker ? worker : "(null)");
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "Status worker '%s' wildcards in sub worker '%s' of worker '%s' not allowed for this command",
+ w->name, sub_worker, worker ? worker : "(null)");
p->msg = "wildcard not allowed in sub worker for this command";
JK_TRACE_EXIT(l);
return JK_FALSE;
@@ -4015,9 +4015,9 @@ static void count_workers(jk_ws_service_t *s,
for (i = 0; i < w->we->num_of_workers; i++) {
jw = wc_get_worker_for_name(w->we->worker_list[i], l);
if (!jw) {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' could not find worker '%s'",
- w->name, w->we->worker_list[i]);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' could not find worker '%s'",
+ w->name, w->we->worker_list[i]);
continue;
}
if (jw->type == JK_LB_WORKER_TYPE) {
@@ -4121,9 +4121,9 @@ static void list_workers_type(jk_ws_service_t *s,
for (i = 0; i < w->we->num_of_workers; i++) {
jw = wc_get_worker_for_name(w->we->worker_list[i], l);
if (!jw) {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' could not find worker '%s'",
- w->name, w->we->worker_list[i]);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' could not find worker '%s'",
+ w->name, w->we->worker_list[i]);
continue;
}
if ((list_lb && jw->type == JK_LB_WORKER_TYPE) ||
@@ -4240,16 +4240,16 @@ static int edit_worker(jk_ws_service_t *s,
if (status_get_string(p, JK_STATUS_ARG_ATTRIBUTE,
NULL, &arg, l) == JK_TRUE) {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' %s lb worker '%s' with all sub workers",
- w->name, "editing", lb->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' %s lb worker '%s' with all sub workers",
+ w->name, "editing", lb->name);
form_all_members(s, p, jw, arg, l);
}
else {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' %s lb worker '%s'",
- w->name, "editing", lb->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' %s lb worker '%s'",
+ w->name, "editing", lb->name);
form_worker(s, p, jw, l);
}
JK_TRACE_EXIT(l);
@@ -4262,9 +4262,9 @@ static int edit_worker(jk_ws_service_t *s,
return JK_FALSE;
}
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' %s lb worker '%s' sub worker '%s'",
- w->name, "editing", lb->name, wr->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' %s lb worker '%s' sub worker '%s'",
+ w->name, "editing", lb->name, wr->name);
aw = (ajp_worker_t *)wr->worker->worker_private;
form_member(s, p, wr, aw, worker, l);
JK_TRACE_EXIT(l);
@@ -4276,9 +4276,9 @@ static int edit_worker(jk_ws_service_t *s,
ajp_worker_t *aw = (ajp_worker_t *)jw->worker_private;
if (aw) {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' %s ajp worker '%s'",
- w->name, "editing", aw->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' %s ajp worker '%s'",
+ w->name, "editing", aw->name);
if (aw->sequence != aw->s->h.sequence)
jk_ajp_pull(aw, JK_FALSE, l);
form_member(s, p, NULL, aw, worker, l);
@@ -4286,16 +4286,16 @@ static int edit_worker(jk_ws_service_t *s,
return JK_TRUE;
}
else {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' aw worker is (null)",
- w->name);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' aw worker is (null)",
+ w->name);
}
}
else {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' worker type not implemented",
- w->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' worker type not implemented",
+ w->name);
}
JK_TRACE_EXIT(l);
return JK_FALSE;
@@ -4335,16 +4335,16 @@ static int update_worker(jk_ws_service_t *s,
if (status_get_string(p, JK_STATUS_ARG_ATTRIBUTE,
NULL, &arg, l) == JK_TRUE) {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' %s lb worker '%s' with all sub workers",
- w->name, "updating", lb->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' %s lb worker '%s' with all sub workers",
+ w->name, "updating", lb->name);
commit_all_members(s, p, jw, arg, l);
}
else {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' %s lb worker '%s'",
- w->name, "updating", lb->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' %s lb worker '%s'",
+ w->name, "updating", lb->name);
commit_worker(s, p, jw, l);
}
JK_TRACE_EXIT(l);
@@ -4374,9 +4374,9 @@ static int update_worker(jk_ws_service_t *s,
}
}
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' %s lb worker '%s' sub worker '%s'",
- w->name, "updating", lb->name, wr->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' %s lb worker '%s' sub worker '%s'",
+ w->name, "updating", lb->name, wr->name);
aw = (ajp_worker_t *)wr->worker->worker_private;
rv = 0;
rc = commit_member(s, p, lb, wr, aw, &rv, l);
@@ -4394,9 +4394,9 @@ static int update_worker(jk_ws_service_t *s,
jk_lb_push(lb, JK_TRUE, rv & JK_STATUS_NEEDS_UPDATE_MULT ? JK_TRUE: JK_FALSE, l);
}
if (rc == JK_FALSE) {
- jk_log(l, JK_LOG_ERROR,
- "Status worker '%s' failed updating sub worker '%s' (at least partially).%s",
- w->name, aw->name, (is_wildchar == JK_TRUE) ? " Aborting further wildcard updates." : "");
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "Status worker '%s' failed updating sub worker '%s' (at least partially).%s",
+ w->name, aw->name, (is_wildchar == JK_TRUE) ? " Aborting further wildcard updates." : "");
if (!strncmp("OK", p->msg, 3)) {
const char *msg = "Update failed (at least partially) for sub worker '%s'";
size_t size = strlen(msg) + strlen(aw->name) + 1;
@@ -4423,9 +4423,9 @@ static int update_worker(jk_ws_service_t *s,
ajp_worker_t *aw = (ajp_worker_t *)jw->worker_private;
if (aw) {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' %s ajp worker '%s'",
- w->name, "updating", aw->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' %s ajp worker '%s'",
+ w->name, "updating", aw->name);
if (aw->sequence != aw->s->h.sequence)
jk_ajp_pull(aw, JK_TRUE, l);
rv = 0;
@@ -4438,9 +4438,9 @@ static int update_worker(jk_ws_service_t *s,
jk_ajp_push(aw, JK_TRUE, l);
}
if (rc == JK_FALSE) {
- jk_log(l, JK_LOG_ERROR,
- "Status worker '%s' failed updating worker '%s' (at least partially).",
- w->name, aw->name);
+ jk_request_log(s, l, JK_LOG_ERROR,
+ "Status worker '%s' failed updating worker '%s' (at least partially).",
+ w->name, aw->name);
if (!strncmp("OK", p->msg, 3)) {
const char *msg = "Update failed (at least partially) for worker '%s'";
size_t size = strlen(msg) + strlen(aw->name) + 1;
@@ -4452,16 +4452,16 @@ static int update_worker(jk_ws_service_t *s,
return rc;
}
else {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' aw worker is (null)",
- w->name);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' aw worker is (null)",
+ w->name);
}
}
else {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' worker type not implemented",
- w->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' worker type not implemented",
+ w->name);
}
JK_TRACE_EXIT(l);
return JK_FALSE;
@@ -4497,9 +4497,9 @@ static int reset_worker(jk_ws_service_t *s,
if (!sub_worker || !sub_worker[0]) {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' %s lb worker '%s' with all sub workers",
- w->name, "resetting", lb->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' %s lb worker '%s' with all sub workers",
+ w->name, "resetting", lb->name);
lb->s->max_busy = 0;
lb->s->last_reset = now;
for (i = 0; i < lb->num_of_workers; i++) {
@@ -4531,9 +4531,9 @@ static int reset_worker(jk_ws_service_t *s,
return JK_FALSE;
}
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' %s lb worker '%s' sub worker '%s'",
- w->name, "resetting", lb->name, wr->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' %s lb worker '%s' sub worker '%s'",
+ w->name, "resetting", lb->name, wr->name);
aw = (ajp_worker_t *)wr->worker->worker_private;
wr->s->state = JK_LB_STATE_IDLE;
wr->s->elected_snapshot = 0;
@@ -4559,9 +4559,9 @@ static int reset_worker(jk_ws_service_t *s,
ajp_worker_t *aw = (ajp_worker_t *)jw->worker_private;
if (aw) {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' %s ajp worker '%s'",
- w->name, "resetting", aw->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' %s ajp worker '%s'",
+ w->name, "resetting", aw->name);
aw->s->errors = 0;
aw->s->used = 0;
aw->s->client_errors = 0;
@@ -4575,16 +4575,16 @@ static int reset_worker(jk_ws_service_t *s,
return JK_TRUE;
}
else {
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' aw worker is (null)",
- w->name);
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' aw worker is (null)",
+ w->name);
}
}
else {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' worker type not implemented",
- w->name);
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' worker type not implemented",
+ w->name);
}
JK_TRACE_EXIT(l);
return JK_FALSE;
@@ -4638,16 +4638,16 @@ static int recover_worker(jk_ws_service_t *s,
aw->s->reply_timeouts = 0;
wr->s->state = JK_LB_STATE_RECOVER;
- jk_log(l, JK_LOG_INFO,
- "Status worker '%s' marked worker '%s' sub worker '%s' for recovery",
- w->name, worker ? worker : "(null)", sub_worker ? sub_worker : "(null)");
+ jk_request_log(s, l, JK_LOG_INFO,
+ "Status worker '%s' marked worker '%s' sub worker '%s' for recovery",
+ w->name, worker ? worker : "(null)", sub_worker ? sub_worker : "(null)");
JK_TRACE_EXIT(l);
return JK_TRUE;
}
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' could not mark worker '%s' sub worker '%s' for recovery - state %s is not an error state",
- w->name, worker ? worker : "(null)", sub_worker ? sub_worker : "(null)",
- jk_lb_get_state(wr, l));
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' could not mark worker '%s' sub worker '%s' for recovery - state %s is not an error state",
+ w->name, worker ? worker : "(null)", sub_worker ? sub_worker : "(null)",
+ jk_lb_get_state(wr, l));
JK_TRACE_EXIT(l);
return JK_FALSE;
}
@@ -4815,43 +4815,43 @@ static int JK_METHOD service(jk_endpoint_t *e,
if (denied == 0) {
if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "Status worker '%s' service allowed for user '%s' [%s] from %s [%s]",
- w->name,
- s->remote_user ? s->remote_user : "(null)",
- s->auth_type ? s->auth_type : "(null)",
- s->remote_addr ? s->remote_addr : "(null)",
- s->remote_host ? s->remote_host : "(null)");
+ jk_request_log(s, l, JK_LOG_DEBUG,
+ "Status worker '%s' service allowed for user '%s' [%s] from %s [%s]",
+ w->name,
+ s->remote_user ? s->remote_user : "(null)",
+ s->auth_type ? s->auth_type : "(null)",
+ s->remote_addr ? s->remote_addr : "(null)",
+ s->remote_host ? s->remote_host : "(null)");
}
else if (denied == 1) {
err = "Access denied.";
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' service denied for user '%s' [%s] from %s [%s]",
- w->name,
- s->remote_user ? s->remote_user : "(null)",
- s->auth_type ? s->auth_type : "(null)",
- s->remote_addr ? s->remote_addr : "(null)",
- s->remote_host ? s->remote_host : "(null)");
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' service denied for user '%s' [%s] from %s [%s]",
+ w->name,
+ s->remote_user ? s->remote_user : "(null)",
+ s->auth_type ? s->auth_type : "(null)",
+ s->remote_addr ? s->remote_addr : "(null)",
+ s->remote_host ? s->remote_host : "(null)");
}
else if (denied == 2) {
err = "Access denied.";
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' service denied (no user) [%s] from %s [%s]",
- w->name,
- s->remote_user ? s->remote_user : "(null)",
- s->auth_type ? s->auth_type : "(null)",
- s->remote_addr ? s->remote_addr : "(null)",
- s->remote_host ? s->remote_host : "(null)");
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' service denied (no user) [%s] from %s [%s]",
+ w->name,
+ s->remote_user ? s->remote_user : "(null)",
+ s->auth_type ? s->auth_type : "(null)",
+ s->remote_addr ? s->remote_addr : "(null)",
+ s->remote_host ? s->remote_host : "(null)");
}
else {
err = "Access denied.";
- jk_log(l, JK_LOG_WARNING,
- "Status worker '%s' service denied (unknown reason) for user '%s' [%s] from %s [%s]",
- w->name,
- s->remote_user ? s->remote_user : "(null)",
- s->auth_type ? s->auth_type : "(null)",
- s->remote_addr ? s->remote_addr : "(null)",
- s->remote_host ? s->remote_host : "(null)");
+ jk_request_log(s, l, JK_LOG_WARNING,
+ "Status worker '%s' service denied (unknown reason) for user '%s' [%s] from %s [%s]",
+ w->name,
+ s->remote_user ? s->remote_user : "(null)",
+ s->auth_type ? s->auth_type : "(null)",
+ s->remote_addr ? s->remote_addr : "(null)",
+ s->remote_host ? s->remote_host : "(null)");
}
if (!err) {
@@ -5185,7 +5185,7 @@ static int JK_METHOD service(jk_endpoint_t *e,
}
}
if (err) {
- jk_log(l, JK_LOG_WARNING, "Status worker '%s': %s", w->name, err);
+ jk_request_log(s, l, JK_LOG_WARNING, "Status worker '%s': %s", w->name, err);
if (mime == JK_STATUS_MIME_HTML) {
jk_putv(s, "<p><b>Result: ERROR - ", err, "</b><br/>", NULL);
jk_putv(s, "<a href=\"", s->req_uri, "\">JK Status Manager Start Page</a></p>", NULL);
diff --git a/native/iis/jk_isapi_plugin.c b/native/iis/jk_isapi_plugin.c
index f2f4320a1..c0d7a4353 100644
--- a/native/iis/jk_isapi_plugin.c
+++ b/native/iis/jk_isapi_plugin.c
@@ -886,15 +886,15 @@ static int JK_METHOD start_response(jk_ws_service_t *s,
isapi_private_data_t *p;
JK_TRACE_ENTER(logger);
- if (status < 100 || status > 1000) {
- jk_log(logger, JK_LOG_ERROR,
- "invalid status %d",
- status);
+ if (s == NULL || s->ws_private == NULL) {
+ JK_LOG_NULL_PARAMS(logger);
JK_TRACE_EXIT(logger);
return JK_FALSE;
}
- if (s == NULL || s->ws_private == NULL) {
- JK_LOG_NULL_PARAMS(logger);
+ if (status < 100 || status > 1000) {
+ jk_request_log(s, logger, JK_LOG_ERROR,
+ "invalid status %d",
+ status);
JK_TRACE_EXIT(logger);
return JK_FALSE;
}
@@ -917,9 +917,9 @@ static int JK_METHOD start_response(jk_ws_service_t *s,
}
}
if (found == JK_FALSE) {
- jk_log(logger, JK_LOG_INFO,
- "origin server sent 401 without"
- " WWW-Authenticate header");
+ jk_request_log(s, logger, JK_LOG_INFO,
+ "origin server sent 401 without"
+ " WWW-Authenticate header");
}
}
return JK_TRUE;
@@ -935,8 +935,8 @@ static int JK_METHOD start_response(jk_ws_service_t *s,
s->response_started = JK_TRUE;
if (JK_IS_DEBUG_LEVEL(logger)) {
- jk_log(logger, JK_LOG_DEBUG, "Starting response for URI '%s' (protocol %s)",
- s->req_uri, s->protocol);
+ jk_request_log(s, logger, JK_LOG_DEBUG, "Starting response for URI '%s' (protocol %s)",
+ s->req_uri, s->protocol);
}
/*
@@ -975,7 +975,7 @@ static int JK_METHOD start_response(jk_ws_service_t *s,
p->chunk_content = JK_FALSE;
/* Keep alive is still possible */
if (JK_IS_DEBUG_LEVEL(logger))
- jk_log(logger, JK_LOG_DEBUG, "Response status %d implies no message body", status );
+ jk_request_log(s, logger, JK_LOG_DEBUG, "Response status %d implies no message body", status );
}
if (p->chunk_content) {
for (i = 0; i < num_of_headers; i++) {
@@ -990,14 +990,14 @@ static int JK_METHOD start_response(jk_ws_service_t *s,
if (!strcasecmp(CONTENT_LENGTH_HEADER_NAME, header_names[i])) {
p->chunk_content = JK_FALSE;
if (JK_IS_DEBUG_LEVEL(logger))
- jk_log(logger, JK_LOG_DEBUG, "Response specifies Content-Length" );
+ jk_request_log(s, logger, JK_LOG_DEBUG, "Response specifies Content-Length" );
}
else if (!strcasecmp(CONNECTION_HEADER_NAME, header_names[i])
&& !strcasecmp(CONNECTION_CLOSE_VALUE, header_values[i])) {
keep_alive = FALSE;
p->chunk_content = JK_FALSE;
if (JK_IS_DEBUG_LEVEL(logger))
- jk_log(logger, JK_LOG_DEBUG, "Response specifies Connection: Close" );
+ jk_request_log(s, logger, JK_LOG_DEBUG, "Response specifies Connection: Close" );
}
else if (!strcasecmp(TRANSFER_ENCODING_HEADER_NAME, header_names[i])
&& !strcasecmp(TRANSFER_ENCODING_IDENTITY_VALUE, header_values[i])) {
@@ -1005,7 +1005,7 @@ static int JK_METHOD start_response(jk_ws_service_t *s,
* 'identity' is the same as absence of the header */
p->chunk_content = JK_FALSE;
if (JK_IS_DEBUG_LEVEL(logger))
- jk_log(logger, JK_LOG_DEBUG, "Response specifies Transfer-Encoding" );
+ jk_request_log(s, logger, JK_LOG_DEBUG, "Response specifies Transfer-Encoding" );
}
}
@@ -1029,7 +1029,7 @@ static int JK_METHOD start_response(jk_ws_service_t *s,
if (p->chunk_content) {
/* Configure the response if chunked encoding is used */
if (JK_IS_DEBUG_LEVEL(logger))
- jk_log(logger, JK_LOG_DEBUG, "Using Transfer-Encoding: chunked");
+ jk_request_log(s, logger, JK_LOG_DEBUG, "Using Transfer-Encoding: chunked");
/** We will supply the transfer-encoding to allow IIS to keep the connection open */
keep_alive = TRUE;
@@ -1044,7 +1044,7 @@ static int JK_METHOD start_response(jk_ws_service_t *s,
StringCbCat(headers_str, len_of_headers, CRLF);
if (JK_IS_DEBUG_LEVEL(logger))
- jk_log(logger, JK_LOG_DEBUG, "%ssing Keep-Alive", (keep_alive ? "U" : "Not u"));
+ jk_request_log(s, logger, JK_LOG_DEBUG, "%ssing Keep-Alive", (keep_alive ? "U" : "Not u"));
if (keep_alive) {
HSE_SEND_HEADER_EX_INFO hi;
@@ -1078,9 +1078,9 @@ static int JK_METHOD start_response(jk_ws_service_t *s,
}
if (!rc) {
- jk_log(logger, JK_LOG_ERROR,
- "HSE_REQ_SEND_RESPONSE_HEADER%s failed with error=%d (0x%08x)",
- (keep_alive ? "_EX" : ""), GetLastError(), GetLastError());
+ jk_request_log(s, logger, JK_LOG_ERROR,
+ "HSE_REQ_SEND_RESPONSE_HEADER%s failed with error=%d (0x%08x)",
+ (keep_alive ? "_EX" : ""), GetLastError(), GetLastError());
rv = JK_FALSE;
}
if (headers_str)
@@ -1113,10 +1113,10 @@ static int JK_METHOD iis_read(jk_ws_service_t *s,
}
p = s->ws_private;
if (JK_IS_DEBUG_LEVEL(logger)) {
- jk_log(logger, JK_LOG_DEBUG,
- "Preparing to read %d bytes. "
- "ECB reports %d bytes total, with %d available.",
- l, p->lpEcb->cbTotalBytes, p->lpEcb->cbAvailable);
+ jk_request_log(s, logger, JK_LOG_DEBUG,
+ "Preparing to read %d bytes. "
+ "ECB reports %d bytes total, with %d available.",
+ l, p->lpEcb->cbTotalBytes, p->lpEcb->cbAvailable);
}
*a = 0;
@@ -1126,9 +1126,9 @@ static int JK_METHOD iis_read(jk_ws_service_t *s,
if (already_read >= l) {
if (JK_IS_DEBUG_LEVEL(logger)) {
- jk_log(logger, JK_LOG_DEBUG,
- "Already read %d bytes - supplying %d bytes from buffer",
- already_read, l);
+ jk_request_log(s, logger, JK_LOG_DEBUG,
+ "Already read %d bytes - supplying %d bytes from buffer",
+ already_read, l);
}
memcpy(buf, p->lpEcb->lpbData + p->bytes_read_so_far, l);
p->bytes_read_so_far += l;
@@ -1140,9 +1140,9 @@ static int JK_METHOD iis_read(jk_ws_service_t *s,
*/
if (already_read > 0) {
if (JK_IS_DEBUG_LEVEL(logger)) {
- jk_log(logger, JK_LOG_DEBUG,
- "Supplying %d bytes from buffer",
- already_read);
+ jk_request_log(s, logger, JK_LOG_DEBUG,
+ "Supplying %d bytes from buffer",
+ already_read);
}
memcpy(buf, p->lpEcb->lpbData + p->bytes_read_so_far,
already_read);
@@ -1157,8 +1157,8 @@ static int JK_METHOD iis_read(jk_ws_service_t *s,
* Now try to read from the client ...
*/
if (JK_IS_DEBUG_LEVEL(logger)) {
- jk_log(logger, JK_LOG_DEBUG,
- "Attempting to read %d bytes from client", l);
+ jk_request_log(s, logger, JK_LOG_DEBUG,
+ "Attempting to read %d bytes from client", l);
}
if (p->lpEcb->ReadClient(p->lpEcb->ConnID, buf, &l)) {
/* ReadClient will succeed with dwSize == 0 for last chunk
@@ -1166,8 +1166,8 @@ static int JK_METHOD iis_read(jk_ws_service_t *s,
*a += l;
}
else {
- jk_log(logger, JK_LOG_ERROR,
- "ReadClient failed with %d (0x%08x)", GetLastError(), GetLastError());
+ jk_request_log(s, logger, JK_LOG_ERROR,
+ "ReadClient failed with %d (0x%08x)", GetLastError(), GetLastError());
JK_TRACE_EXIT(logger);
return JK_FALSE;
}
@@ -1272,16 +1272,16 @@ static int JK_METHOD iis_write(jk_ws_service_t *s, const void *b, unsigned int l
response_vector.lpElementArray = response_elements;
if (JK_IS_DEBUG_LEVEL(logger))
- jk_log(logger, JK_LOG_DEBUG,
- "Using vector write for chunk encoded %d byte chunk", l);
+ jk_request_log(s, logger, JK_LOG_DEBUG,
+ "Using vector write for chunk encoded %d byte chunk", l);
if (!p->lpEcb->ServerSupportFunction(p->lpEcb->ConnID,
HSE_REQ_VECTOR_SEND,
&response_vector,
NULL, NULL)) {
- jk_log(logger, JK_LOG_ERROR,
- "Vector write of chunk encoded response failed with %d (0x%08x)",
- GetLastError(), GetLastError());
+ jk_request_log(s, logger, JK_LOG_ERROR,
+ "Vector write of chunk encoded response failed with %d (0x%08x)",
+ GetLastError(), GetLastError());
JK_TRACE_EXIT(logger);
return JK_FALSE;
}
@@ -1289,32 +1289,32 @@ static int JK_METHOD iis_write(jk_ws_service_t *s, const void *b, unsigned int l
else {
/* Write chunk header */
if (JK_IS_DEBUG_LEVEL(logger))
- jk_log(logger, JK_LOG_DEBUG,
- "Using chunked encoding - writing chunk header for %d byte chunk", l);
+ jk_request_log(s, logger, JK_LOG_DEBUG,
+ "Using chunked encoding - writing chunk header for %d byte chunk", l);
if (!isapi_write_client(p, chunk_header, lstrlenA(chunk_header))) {
- jk_log(logger, JK_LOG_ERROR, "WriteClient for chunk header failed");
+ jk_request_log(s, logger, JK_LOG_ERROR, "WriteClient for chunk header failed");
JK_TRACE_EXIT(logger);
return JK_FALSE;
}
/* Write chunk body (or simple body block) */
if (JK_IS_DEBUG_LEVEL(logger)) {
- jk_log(logger, JK_LOG_DEBUG, "Writing %s of size %d",
- (p->chunk_content ? "chunk body" : "simple response"), l);
+ jk_request_log(s, logger, JK_LOG_DEBUG, "Writing %s of size %d",
+ (p->chunk_content ? "chunk body" : "simple response"), l);
}
if (!isapi_write_client(p, buf, l)) {
- jk_log(logger, JK_LOG_ERROR, "WriteClient for response body chunk failed");
+ jk_request_log(s, logger, JK_LOG_ERROR, "WriteClient for response body chunk failed");
JK_TRACE_EXIT(logger);
return JK_FALSE;
}
/* Write chunk trailer */
if (JK_IS_DEBUG_LEVEL(logger)) {
- jk_log(logger, JK_LOG_DEBUG, "Using chunked encoding - writing chunk trailer");
+ jk_request_log(s, logger, JK_LOG_DEBUG, "Using chunked encoding - writing chunk trailer");
}
if (!isapi_write_client(p, CRLF, CRLF_LEN)) {
- jk_log(logger, JK_LOG_ERROR, "WriteClient for chunk trailer failed");
+ jk_request_log(s, logger, JK_LOG_ERROR, "WriteClient for chunk trailer failed");
JK_TRACE_EXIT(logger);
return JK_FALSE;
}
@@ -1361,28 +1361,28 @@ static int JK_METHOD iis_done(jk_ws_service_t *s)
response_vector.lpElementArray = response_elements;
if (JK_IS_DEBUG_LEVEL(logger))
- jk_log(logger, JK_LOG_DEBUG,
- "Using vector write to terminate chunk encoded response.");
+ jk_request_log(s, logger, JK_LOG_DEBUG,
+ "Using vector write to terminate chunk encoded response.");
if (!p->lpEcb->ServerSupportFunction(p->lpEcb->ConnID,
HSE_REQ_VECTOR_SEND,
&response_vector,
NULL, NULL)) {
- jk_log(logger, JK_LOG_ERROR,
- "Vector termination of chunk encoded response failed with %d (0x%08x)",
- GetLastError(), GetLastError());
+ jk_request_log(s, logger, JK_LOG_ERROR,
+ "Vector termination of chunk encoded response failed with %d (0x%08x)",
+ GetLastError(), GetLastError());
JK_TRACE_EXIT(logger);
return JK_FALSE;
}
}
else {
if (JK_IS_DEBUG_LEVEL(logger))
- jk_log(logger, JK_LOG_DEBUG, "Terminating chunk encoded response");
+ jk_request_log(s, logger, JK_LOG_DEBUG, "Terminating chunk encoded response");
if (!isapi_write_client(p, CHUNKED_ENCODING_TRAILER, CHUNKED_ENCODING_TRAILER_LEN)) {
- jk_log(logger, JK_LOG_ERROR,
- "WriteClient for chunked response terminator failed with %d (0x%08x)",
- GetLastError(), GetLastError());
+ jk_request_log(s, logger, JK_LOG_ERROR,
+ "WriteClient for chunked response terminator failed with %d (0x%08x)",
+ GetLastError(), GetLastError());
JK_TRACE_EXIT(logger);
return JK_FALSE;
}
@@ -2082,16 +2082,16 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpEcb)
jk_worker_t *worker = wc_get_worker_for_name(worker_name, logger);
if (!worker) {
- jk_log(logger, JK_LOG_ERROR,
- "could not get a worker for name %s",
- worker_name);
+ jk_request_log(&s, logger, JK_LOG_ERROR,
+ "could not get a worker for name %s",
+ worker_name);
jk_close_pool(&private_data.p);
JK_TRACE_EXIT(logger);
return rc;
}
if (JK_IS_DEBUG_LEVEL(logger))
- jk_log(logger, JK_LOG_DEBUG,
- "got a worker for name %s", worker_name);
+ jk_request_log(&s, logger, JK_LOG_DEBUG,
+ "got a worker for name %s", worker_name);
if (worker->get_endpoint(worker, &e, logger)) {
int is_error = JK_HTTP_SERVER_ERROR;
int result;
@@ -2099,9 +2099,9 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpEcb)
if (s.extension.use_server_error_pages &&
s.http_response_status >= s.extension.use_server_error_pages) {
if (JK_IS_DEBUG_LEVEL(logger))
- jk_log(logger, JK_LOG_DEBUG, "Forwarding status=%d"
- " for worker=%s",
- s.http_response_status, worker_name);
+ jk_request_log(&s, logger, JK_LOG_DEBUG, "Forwarding status=%d"
+ " for worker=%s",
+ s.http_response_status, worker_name);
lpEcb->dwHttpStatusCode = s.http_response_status;
write_error_message(lpEcb, s.http_response_status,
private_data.err_hdrs);
@@ -2110,18 +2110,18 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpEcb)
rc = HSE_STATUS_SUCCESS;
lpEcb->dwHttpStatusCode = s.http_response_status;
if (JK_IS_DEBUG_LEVEL(logger))
- jk_log(logger, JK_LOG_DEBUG,
- "service() returned OK");
+ jk_request_log(&s, logger, JK_LOG_DEBUG,
+ "service() returned OK");
}
}
else {
if ((result == JK_CLIENT_ERROR) && (is_error == JK_HTTP_OK)) {
- jk_log(logger, JK_LOG_INFO,
- "service() failed because client aborted connection");
+ jk_request_log(&s, logger, JK_LOG_INFO,
+ "service() failed because client aborted connection");
}
else {
- jk_log(logger, JK_LOG_ERROR,
- "service() failed with http error %d", is_error);
+ jk_request_log(&s, logger, JK_LOG_ERROR,
+ "service() failed with http error %d", is_error);
}
lpEcb->dwHttpStatusCode = is_error;
write_error_message(lpEcb, is_error, private_data.err_hdrs);
@@ -2130,9 +2130,9 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpEcb)
}
else {
int is_error = JK_HTTP_SERVER_BUSY;
- jk_log(logger, JK_LOG_ERROR,
- "Failed to obtain an endpoint to service request - "
- "your connection_pool_size is probably less than the threads in your web server!");
+ jk_request_log(&s, logger, JK_LOG_ERROR,
+ "Failed to obtain an endpoint to service request - "
+ "your connection_pool_size is probably less than the threads in your web server!");
lpEcb->dwHttpStatusCode = is_error;
write_error_message(lpEcb, is_error, private_data.err_hdrs);
}
@@ -2963,11 +2963,10 @@ static int init_ws_service(isapi_private_data_t * private_data,
GET_SERVER_VARIABLE_VALUE(HTTP_URI_HEADER_NAME, s->req_uri, NULL);
- /* XXX Add request_id generation */
s->request_id = NULL;
if (s->req_uri == NULL) {
if (JK_IS_DEBUG_LEVEL(logger))
- jk_log(logger, JK_LOG_DEBUG, "No URI header value provided. Defaulting to old behaviour" );
+ jk_request_log(s, logger, JK_LOG_DEBUG, "No URI header value provided. Defaulting to old behaviour" );
s->query_string = private_data->lpEcb->lpszQueryString;
*worker_name = DEFAULT_WORKER_NAME;
GET_SERVER_VARIABLE_VALUE("URL", s->req_uri, "");
@@ -2983,12 +2982,13 @@ static int init_ws_service(isapi_private_data_t * private_data,
}
if (JK_IS_DEBUG_LEVEL(logger)) {
- jk_log(logger, JK_LOG_DEBUG, "Reading extension header %s: %s", HTTP_WORKER_HEADER_NAME, (*worker_name));
- jk_log(logger, JK_LOG_DEBUG, "Reading extension header %s: %d", HTTP_WORKER_HEADER_INDEX, worker_index);
- jk_log(logger, JK_LOG_DEBUG, "Reading extension header %s: %s", HTTP_URI_HEADER_NAME, s->req_uri);
- jk_log(logger, JK_LOG_DEBUG, "Reading extension header %s: %s", HTTP_QUERY_HEADER_NAME, s->query_string);
+ jk_request_log(s, logger, JK_LOG_DEBUG, "Reading extension header %s: %s", HTTP_WORKER_HEADER_NAME, (*worker_name));
+ jk_request_log(s, logger, JK_LOG_DEBUG, "Reading extension header %s: %d", HTTP_WORKER_HEADER_INDEX, worker_index);
+ jk_request_log(s, logger, JK_LOG_DEBUG, "Reading extension header %s: %s", HTTP_URI_HEADER_NAME, s->req_uri);
+ jk_request_log(s, logger, JK_LOG_DEBUG, "Reading extension header %s: %s", HTTP_QUERY_HEADER_NAME, s->query_string);
}
+ /* XXX Add request_id generation */
GET_SERVER_VARIABLE_VALUE("AUTH_TYPE", s->auth_type, NULL);
GET_SERVER_VARIABLE_VALUE("REMOTE_USER", s->remote_user, NULL);
GET_SERVER_VARIABLE_VALUE("SERVER_PROTOCOL", s->protocol, "");
@@ -3010,15 +3010,15 @@ static int init_ws_service(isapi_private_data_t * private_data,
if (strcasecmp(temp_buf, TRANSFER_ENCODING_CHUNKED_VALUE) == 0) {
s->is_chunked = JK_TRUE;
if (JK_IS_DEBUG_LEVEL(logger)) {
- jk_log(logger, JK_LOG_DEBUG, "Request is Transfer-Encoding: chunked");
+ jk_request_log(s, logger, JK_LOG_DEBUG, "Request is Transfer-Encoding: chunked");
}
}
else {
/* XXX: What to do with non chunked T-E ?
*/
if (JK_IS_DEBUG_LEVEL(logger))
- jk_log(logger, JK_LOG_DEBUG, "Unsupported Transfer-Encoding: %s",
- temp_buf);
+ jk_request_log(s, logger, JK_LOG_DEBUG, "Unsupported Transfer-Encoding: %s",
+ temp_buf);
}
}
if (private_data->lpEcb->cbTotalBytes == 0xFFFFFFFF) {
@@ -3034,7 +3034,7 @@ static int init_ws_service(isapi_private_data_t * private_data,
e = get_uri_to_worker_ext(uw_map, worker_index);
if (e) {
if (JK_IS_DEBUG_LEVEL(logger))
- jk_log(logger, JK_LOG_DEBUG, "Applying service extensions" );
+ jk_request_log(s, logger, JK_LOG_DEBUG, "Applying service extensions" );
s->extension.reply_timeout = e->reply_timeout;
s->extension.sticky_ignore = e->sticky_ignore;
s->extension.stateless = e->stateless;
@@ -3135,12 +3135,12 @@ static int init_ws_service(isapi_private_data_t * private_data,
if (private_data->lpEcb->ServerSupportFunction(private_data->lpEcb->ConnID,
HSE_REQ_GET_CERT_INFO_EX,
&cc, NULL, NULL) != FALSE) {
- jk_log(logger, JK_LOG_DEBUG,
- "Client Certificate encoding:%d sz:%d flags:%ld",
- cc.CertContext.
- dwCertEncodingType & X509_ASN_ENCODING,
- cc.CertContext.cbCertEncoded,
- cc.dwCertificateFlags);
+ jk_request_log(s, logger, JK_LOG_DEBUG,
+ "Client Certificate encoding:%d sz:%d flags:%ld",
+ cc.CertContext.
+ dwCertEncodingType & X509_ASN_ENCODING,
+ cc.CertContext.cbCertEncoded,
+ cc.dwCertificateFlags);
s->ssl_cert = jk_pool_alloc(&private_data->p,
base64_encode_cert_len(cc.CertContext.cbCertEncoded));
s->ssl_cert_len = base64_encode_cert(s->ssl_cert, cb,
@@ -3211,9 +3211,9 @@ static int init_ws_service(isapi_private_data_t * private_data,
*/
if (unknown_content_length || s->is_chunked) {
if (JK_IS_DEBUG_LEVEL(logger)) {
- jk_log(logger, JK_LOG_DEBUG,
- "Disregarding Content-Length in request - content is %s",
- s->is_chunked ? "chunked" : "unknown length");
+ jk_request_log(s, logger, JK_LOG_DEBUG,
+ "Disregarding Content-Length in request - content is %s",
+ s->is_chunked ? "chunked" : "unknown length");
}
cnt--;
real_header = JK_FALSE;
@@ -3265,8 +3265,8 @@ static int init_ws_service(isapi_private_data_t * private_data,
if (real_header) {
if (JK_IS_DEBUG_LEVEL(logger)) {
- jk_log(logger, JK_LOG_DEBUG, "Forwarding request header %s : %s",
- s->headers_names[i], s->headers_values[i]);
+ jk_request_log(s, logger, JK_LOG_DEBUG, "Forwarding request header %s : %s",
+ s->headers_names[i], s->headers_values[i]);
}
i++;
}
@@ -3277,7 +3277,7 @@ static int init_ws_service(isapi_private_data_t * private_data,
*/
if (need_content_length_header) {
if (JK_IS_DEBUG_LEVEL(logger)) {
- jk_log(logger, JK_LOG_DEBUG, "Incoming request needs explicit Content-Length: 0 in AJP13");
+ jk_request_log(s, logger, JK_LOG_DEBUG, "Incoming request needs explicit Content-Length: 0 in AJP13");
}
s->headers_names[cnt] = "Content-Length";
s->headers_values[cnt] = "0";
@@ -3294,26 +3294,26 @@ static int init_ws_service(isapi_private_data_t * private_data,
* the remote tomcat
*/
if (JK_IS_DEBUG_LEVEL(logger)) {
- jk_log(logger, JK_LOG_DEBUG,
- "Service protocol=%s method=%s host=%s addr=%s name=%s port=%d "
- "auth=%s user=%s uri=%s",
- STRNULL_FOR_NULL(s->protocol),
- STRNULL_FOR_NULL(s->method),
- STRNULL_FOR_NULL(s->remote_host),
- STRNULL_FOR_NULL(s->remote_addr),
- STRNULL_FOR_NULL(s->server_name),
- s->server_port,
- STRNULL_FOR_NULL(s->auth_type),
- STRNULL_FOR_NULL(s->remote_user),
- STRNULL_FOR_NULL(s->req_uri));
- jk_log(logger, JK_LOG_DEBUG,
- "Service request headers=%d attributes=%d "
- "chunked=%s content-length=%" JK_UINT64_T_FMT " available=%u",
- s->num_headers,
- s->num_attributes,
- (s->is_chunked == JK_TRUE) ? "yes" : "no",
- s->content_length,
- private_data->lpEcb->cbTotalBytes);
+ jk_request_log(s, logger, JK_LOG_DEBUG,
+ "Service protocol=%s method=%s host=%s addr=%s name=%s port=%d "
+ "auth=%s user=%s uri=%s",
+ STRNULL_FOR_NULL(s->protocol),
+ STRNULL_FOR_NULL(s->method),
+ STRNULL_FOR_NULL(s->remote_host),
+ STRNULL_FOR_NULL(s->remote_addr),
+ STRNULL_FOR_NULL(s->server_name),
+ s->server_port,
+ STRNULL_FOR_NULL(s->auth_type),
+ STRNULL_FOR_NULL(s->remote_user),
+ STRNULL_FOR_NULL(s->req_uri));
+ jk_request_log(s, logger, JK_LOG_DEBUG,
+ "Service request headers=%d attributes=%d "
+ "chunked=%s content-length=%" JK_UINT64_T_FMT " available=%u",
+ s->num_headers,
+ s->num_attributes,
+ (s->is_chunked == JK_TRUE) ? "yes" : "no",
+ s->content_length,
+ private_data->lpEcb->cbTotalBytes);
}
JK_TRACE_EXIT(logger);
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org