From: Stefan Fritsch Date: Wed, 6 Oct 2010 19:14:44 +0000 (+0000) Subject: add %v and %V to ErrorLogFormat X-Git-Tag: 2.3.9~346 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e4a59c5e139a7432fce70efb23b9b31d94553ef;p=thirdparty%2Fapache%2Fhttpd.git add %v and %V to ErrorLogFormat git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1005208 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/core.xml b/docs/manual/mod/core.xml index f74a47ab065..ec79895825e 100644 --- a/docs/manual/mod/core.xml +++ b/docs/manual/mod/core.xml @@ -1163,6 +1163,15 @@ in case of an error The current time in compact ISO 8601 format, including micro-seconds + %...v + The canonical ServerName + of the current server. + + %...V + The server name of the server serving the request according to the + UseCanonicalName + setting. + (backslash space) Non-field delimiting space diff --git a/server/log.c b/server/log.c index 028eaecbad2..f2036a4e1b7 100644 --- a/server/log.c +++ b/server/log.c @@ -737,6 +737,25 @@ static int log_apr_status(const ap_errorlog_info *info, const char *arg, return len; } +static int log_server_name(const ap_errorlog_info *info, const char *arg, + char *buf, int buflen) +{ + if (info->r) + return cpystrn(buf, ap_get_server_name((request_rec *)info->r), buflen); + + return 0; +} + +static int log_virtual_host(const ap_errorlog_info *info, const char *arg, + char *buf, int buflen) +{ + if (info->s) + return cpystrn(buf, info->s->server_hostname, buflen); + + return 0; +} + + static int log_table_entry(const apr_table_t *table, const char *name, char *buf, int buflen) { @@ -867,6 +886,8 @@ AP_DECLARE(void) ap_register_log_hooks(apr_pool_t *p) ap_register_errorlog_handler(p, "P", log_pid, 0); ap_register_errorlog_handler(p, "t", log_ctime, 0); ap_register_errorlog_handler(p, "T", log_tid, 0); + ap_register_errorlog_handler(p, "v", log_virtual_host, 0); + ap_register_errorlog_handler(p, "V", log_server_name, 0); } /*