Bug 56770

Summary: Add worker name to logging entries
Product: Tomcat Connectors Reporter: Martin Knoblauch <knobi>
Component: mod_jkAssignee: Tomcat Developers Mailing List <dev>
Severity: enhancement    
Priority: P2    
Version: 1.2.40   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: Patch to add worker name
Patched source file

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!