]> granicus.if.org Git - apache/commitdiff
Improve ap_log_cerror:
authorStefan Fritsch <sf@apache.org>
Wed, 10 Mar 2010 13:36:10 +0000 (13:36 +0000)
committerStefan Fritsch <sf@apache.org>
Wed, 10 Mar 2010 13:36:10 +0000 (13:36 +0000)
- Log remote port
- If the connection seems to be a back-end connection, log 'remote' instead of
  'client'

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@921346 13f79535-47bb-0310-9956-ffa450edef68

server/log.c

index b0353d89118426186f76351d729d06cd62f8d369..9d9e24f4d5ca21d414b6ca34802b5fdd430a9326 100644 (file)
@@ -643,13 +643,18 @@ static void log_error_core(const char *file, int line, int level,
     }
 
     if (c) {
-        /* XXX: TODO: add a method of selecting whether logged client
+        /* XXX: TODO: add a method of selecting whether logged remote
          * addresses are in dotted quad or resolved form... dotted
          * quad is the most secure, which is why I'm implementing it
          * first. -djg
          */
+        /*
+         * remote_ip can be client or backend server. If we have a scoreboard
+         * handle, it is likely a client.
+         */
         len += apr_snprintf(errstr + len, MAX_STRING_LEN - len,
-                            "[client %s] ", c->remote_ip);
+                            c->sbh ? "[client %s:%d] " : "[remote %s:%d] ",
+                            c->remote_ip, c->remote_addr->port);
     }
     if (status != 0) {
         if (status < APR_OS_START_EAIERR) {