]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
add %v and %V to ErrorLogFormat
authorStefan Fritsch <sf@apache.org>
Wed, 6 Oct 2010 19:14:44 +0000 (19:14 +0000)
committerStefan Fritsch <sf@apache.org>
Wed, 6 Oct 2010 19:14:44 +0000 (19:14 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1005208 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/mod/core.xml
server/log.c

index f74a47ab065a23ae8c417fae99d3c97397b1645a..ec79895825ee1be62f19fd54a2b34f2bab0d29ec 100644 (file)
@@ -1163,6 +1163,15 @@ in case of an error</description>
         <td>The current time in compact ISO 8601 format, including
             micro-seconds</td></tr>
 
+    <tr><td><code>%...v</code></td>
+        <td>The canonical <directive module="core">ServerName</directive>
+            of the current server.</td></tr>
+
+    <tr><td><code>%...V</code></td>
+        <td>The server name of the server serving the request according to the
+            <directive module="core" >UseCanonicalName</directive>
+            setting.</td></tr>
+
     <tr><td><code>\&nbsp;</code> (backslash space)</td>
         <td>Non-field delimiting space</td></tr>
 
index 028eaecbad23df7929e39c010183b4fcdb4343d0..f2036a4e1b7e40f5ddfb45406de569f346b8278b 100644 (file)
@@ -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);
 }
 
 /*