Bug 56770 - Add worker name to logging entries
Summary: Add worker name to logging entries
Alias: None
Product: Tomcat Connectors
Classification: Unclassified
Component: mod_jk (show other bugs)
Version: 1.2.40
Hardware: PC Linux
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2014-07-24 14:43 UTC by Martin Knoblauch
Modified: 2014-12-21 15:48 UTC (History)
0 users

Patch to add worker name (33.66 KB, patch)
2014-07-24 14:49 UTC, Martin Knoblauch
Details | Diff
Patched source file (120.27 KB, text/plain)
2014-07-24 14:50 UTC, Martin Knoblauch

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Knoblauch 2014-07-24 14:43:16 UTC
It would be good to have the worker name added - when it applies to all log entries. The appended patch tries a stab on it for jk_ajp_common.c
Comment 1 Martin Knoblauch 2014-07-24 14:49:19 UTC
Created attachment 31846 [details]
Patch to add worker name
Comment 2 Martin Knoblauch 2014-07-24 14:50:00 UTC
Created attachment 31847 [details]
Patched source file
Comment 3 Christopher Schultz 2014-07-24 16:29:03 UTC
Is there a reason you moved the call to ajp_update_stats from after the log to before it?
Comment 4 Christopher Schultz 2014-07-24 16:30:45 UTC
Comment on attachment 31847 [details]
Patched source file

Marking patched file as obsolete because it is redundant: the patch itself is sufficient.
Comment 5 Martin Knoblauch 2014-07-25 06:30:26 UTC
Hi Christopher,

 you are talking about this hunk?

@@ -2704,13 +2726,13 @@
         ajp_next_connection(p, l);
+    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.",
-           aw->name);
+           "(%s) connecting to tomcat failed (rc=%d, errors=%d, client_errors=%d).",
+           aw->name,rc,aw->s->errors,aw->s->client_errors);
-    ajp_update_stats(e, aw, rc, l);
     return rc;

Sorry for not mentioning it in the description. The explanation is simple.

Before the addition of the rc/errors/client_errors fields to the log it did not matter where the call to update_stats occurred relative to the logging. Now we want to display the updated numbers - at least I think so, therefore the call to update_stats needs to happen before the logging.

Comment 6 Rainer Jung 2014-12-21 15:48:16 UTC
I have added the patch with minor formatting changes in r1647159, it will be part of mod_jk 1.2.41.
Thanks again for your contribution!