I think I added those after I was frustrated by a customer whose mod_jk
logs had all non-windows line endings. Sorry, I didn't really test your
change, but my experience questions this patch.
Do we need to set text mode on the file? Will this work for direct logs
and piped logs?
Regards,
Rainer
[EMAIL PROTECTED] wrote:
Author: mturk
Date: Thu Mar 22 12:35:34 2007
New Revision: 521417
URL: http://svn.apache.org/viewvc?view=rev&rev=521417
Log:
Fix windows logging. There is no need to add the extra \r, because windows by
default adds them for any text files.
Modified:
tomcat/connectors/trunk/jk/native/common/jk_util.c
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=521417&r1=521416&r2=521417
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_util.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_util.c Thu Mar 22 12:35:34 2007
@@ -397,18 +397,14 @@
if (l &&
(l->level <= level || level == JK_LOG_REQUEST_LEVEL) &&
l->logger_private && what) {
- size_t sz = strlen(what);
- if (sz) {
- file_logger_t *p = l->logger_private;
- if (fwrite(what, 1, sz, p->logfile)) {
- /* [V] Flush the dam' thing! */
- fflush(p->logfile);
- }
+ file_logger_t *p = l->logger_private;
+ if (p->logfile) {
+ fputs(what, p->logfile);
+ /* [V] Flush the dam' thing! */
+ fflush(p->logfile);
}
-
return JK_TRUE;
}
-
return JK_FALSE;
}
@@ -444,6 +440,7 @@
int jk_open_file_logger(jk_logger_t **l, const char *file, int level)
{
if (l && file) {
+
jk_logger_t *rc = (jk_logger_t *)malloc(sizeof(jk_logger_t));
file_logger_t *p = (file_logger_t *) malloc(sizeof(file_logger_t));
if (rc && p) {
@@ -496,11 +493,7 @@
{
int rc = 0;
/* Need to reserve space for newline and terminating zero byte. */
-#ifdef WIN32
- static int usable_size = HUGE_BUFFER_SIZE-3;
-#else
static int usable_size = HUGE_BUFFER_SIZE-2;
-#endif
if (!l || !file || !fmt) {
return -1;
}
@@ -577,17 +570,14 @@
#else
rc = vsnprintf(buf + used, usable_size - used, fmt, args);
#endif
+ va_end(args);
if ( rc <= usable_size - used ) {
used += rc;
} else {
used = usable_size;
}
-#ifdef WIN32
- buf[used++] = '\r';
-#endif
- buf[used] = '\n';
- buf[used+1] = 0;
- va_end(args);
+ buf[used++] = '\n';
+ buf[used] = 0;
l->log(l, level, buf);
#ifdef NETWARE
free(buf);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]