tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r524737 - in /tomcat/connectors/trunk/jk/native: apache-1.3/mod_jk.c apache-2.0/mod_jk.c common/jk_util.c
Date Mon, 02 Apr 2007 07:14:49 GMT
Author: mturk
Date: Mon Apr  2 00:14:47 2007
New Revision: 524737

URL: http://svn.apache.org/viewvc?view=rev&rev=524737
Log:
Fix LF/CRLF logging for POSIX/WIN32 platforms

Modified:
    tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c
    tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
    tomcat/connectors/trunk/jk/native/common/jk_util.c

Modified: tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c?view=diff&rev=524737&r1=524736&r2=524737
==============================================================================
--- tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c (original)
+++ tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c Mon Apr  2 00:14:47 2007
@@ -2370,11 +2370,19 @@
         int log_fd = flp->log_fd;
         size_t sz = strlen(what);
         if (log_fd >= 0 && sz) {
-            if ( write(log_fd, what, sz) < 0 )
-            {
+            if (write(log_fd, what, sz) < 0 ) {
                 ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, NULL,
                              "mod_jk: jk_log_to_file %s failed",
                              what);
+            }
+            else {
+                char c;
+#if defined(WIN32)
+                c = '\n';
+                write(log_fd, &c, 1);
+#endif
+                c = '\n';
+                write(log_fd, &c, 1);
             }
         }
 

Modified: tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c?view=diff&rev=524737&r1=524736&r2=524737
==============================================================================
--- tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c (original)
+++ tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c Mon Apr  2 00:14:47 2007
@@ -2516,6 +2516,10 @@
                                  "mod_jk: jk_log_to_file %s failed: %s",
                                  what, error);
                 }
+#if defined(WIN32)
+                apr_file_putc('\r', p->jklogfp);
+#endif
+                apr_file_putc('\n', p->jklogfp);
                 rv = apr_global_mutex_unlock(jk_log_lock);
                 if (rv != APR_SUCCESS) {
                     ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL,

Modified: tomcat/connectors/trunk/jk/native/common/jk_util.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_util.c?view=diff&rev=524737&r1=524736&r2=524737
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_util.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_util.c Mon Apr  2 00:14:47 2007
@@ -400,6 +400,7 @@
         jk_file_logger_t *p = l->logger_private;
         if (p->logfile) {
             fputs(what, p->logfile);
+            fputc('\n', p->logfile);
             /* [V] Flush the dam' thing! */
             fflush(p->logfile);
         }
@@ -492,8 +493,8 @@
            const char *fmt, ...)
 {
     int rc = 0;
-    /* Need to reserve space for newline and terminating zero byte. */
-    static int usable_size = HUGE_BUFFER_SIZE-2;
+    /* Need to reserve space for terminating zero byte. */
+    static int usable_size = HUGE_BUFFER_SIZE - 1;
     if (!l || !file || !fmt) {
         return -1;
     }
@@ -576,7 +577,6 @@
         } else {
             used = usable_size;
         }
-        buf[used++] = '\n';
         buf[used] = 0;
         l->log(l, level, buf);
 #ifdef NETWARE



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message