*) mpm_winnt: Accept utf-8 (Unicode) service names and descriptions for
internationalization. [William Rowe]
+ *) mod_log_config: Ensure that time data is consistent if multiple
+ duration patterns are used in combination, e.g. %D and %{ms}T.
+ [Rainer Jung]
+
*) mod_log_config: Add "%{UNIT}T" format to output request duration in
seconds, milliseconds or microseconds depending on UNIT ("s", "ms", "us").
[Ben Reser, Rainer Jung]
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
[ start all new proposals below, under PATCHES PROPOSED. ]
- * mod_log_config: Backport get_request_end_time().
- This makes data consistent if a log format uses multiple %{...}T
- and/or %D. The end time of a request is only taken once and the
- same time is used for each log field.
- trunk patch: http://svn.apache.org/r979120 (partial)
- http://svn.apache.org/r1467765
- 2.4.x patch: http://svn.apache.org/r979120 (partial)
- http://svn.apache.org/r1467981
- 2.2.x patch: http://people.apache.org/~rjung/patches/httpd-2.2.x-mod_log_config-get_request_end_time.patch
- +1: rjung, trawick, wrowe
-
-
PATCHES PROPOSED TO BACKPORT FROM TRUNK:
[ New proposals should be added at the end of the list ]
as time stamp in log (httpd traditionally uses start, many
other components, e.g. Tomcat use end time, so they are kind
of hard to correlate). Also add more format choices for time stamps.
- Assumes backport of get_request_end_time() above.
+ Needed get_request_end_time() was already ported back.
trunk patch: http://svn.apache.org/r979120 (remaining parts)
2.4.x patch: http://svn.apache.org/r979120 (remaining parts)
2.2.x patch: http://people.apache.org/~rjung/patches/httpd-2.2.x-mod_log_config-more_time_formats.patch
char *condition_var;
} config_log_state;
+/*
+ * log_request_state holds request specific log data that is not
+ * part of the request_rec.
+ */
+typedef struct {
+ apr_time_t request_end_time;
+} log_request_state;
+
/*
* Format items...
* Note that many of these could have ap_sprintfs replaced with static buffers.
#define TIME_CACHE_MASK 3
static cached_request_time request_time_cache[TIME_CACHE_SIZE];
+static apr_time_t get_request_end_time(request_rec *r)
+{
+ log_request_state *state = (log_request_state *)ap_get_module_config(r->request_config,
+ &log_config_module);
+ if (!state) {
+ state = apr_pcalloc(r->pool, sizeof(log_request_state));
+ ap_set_module_config(r->request_config, &log_config_module, state);
+ }
+ if (state->request_end_time == 0) {
+ state->request_end_time = apr_time_now();
+ }
+ return state->request_end_time;
+}
+
+
static const char *log_request_time(request_rec *r, char *a)
{
apr_time_exp_t xt;
* log_request_time_custom is not inlined right here.)
*/
#ifdef I_INSIST_ON_EXTRA_CYCLES_FOR_CLF_COMPLIANCE
- ap_explode_recent_localtime(&xt, apr_time_now());
+ ap_explode_recent_localtime(&xt, get_request_end_time(r));
#else
ap_explode_recent_localtime(&xt, r->request_time);
#endif
cached_request_time* cached_time = apr_palloc(r->pool,
sizeof(*cached_time));
#ifdef I_INSIST_ON_EXTRA_CYCLES_FOR_CLF_COMPLIANCE
- apr_time_t request_time = apr_time_now();
+ apr_time_t request_time = get_request_end_time(r);
#else
apr_time_t request_time = r->request_time;
#endif
static const char *log_request_duration_microseconds(request_rec *r, char *a)
{
return apr_psprintf(r->pool, "%" APR_TIME_T_FMT,
- (apr_time_now() - r->request_time));
+ (get_request_end_time(r) - r->request_time));
}
static const char *log_request_duration_scaled(request_rec *r, char *a)
{
- apr_time_t duration = apr_time_now() - r->request_time;
+ apr_time_t duration = get_request_end_time(r) - r->request_time;
if (*a == '\0' || !strcasecmp(a, "s")) {
duration = apr_time_sec(duration);
}
config_log_state *clsarray;
int i;
+ /*
+ * Initialize per request state
+ */
+ log_request_state *state = apr_pcalloc(r->pool, sizeof(log_request_state));
+ ap_set_module_config(r->request_config, &log_config_module, state);
+
/*
* Log this transaction..
*/