[pkg-java] r3311 - trunk/commons-daemon/src/native/unix/native

Marcus Better marcusb-guest at alioth.debian.org
Mon Apr 23 13:34:43 UTC 2007


Author: marcusb-guest
Date: 2007-04-23 13:34:41 +0000 (Mon, 23 Apr 2007)
New Revision: 3311

Modified:
   trunk/commons-daemon/src/native/unix/native/debug.c
   trunk/commons-daemon/src/native/unix/native/jsvc-unix.c
Log:
Unclutter debug and error output by not including timestamp and PID. This is superfluous for syslog logging, and can be readily added by an external filter otherwise.


Modified: trunk/commons-daemon/src/native/unix/native/debug.c
===================================================================
--- trunk/commons-daemon/src/native/unix/native/debug.c	2007-04-23 13:22:55 UTC (rev 3310)
+++ trunk/commons-daemon/src/native/unix/native/debug.c	2007-04-23 13:34:41 UTC (rev 3311)
@@ -14,10 +14,9 @@
    limitations under the License.
 */
 /* @version $Id: debug.c 165119 2005-04-28 09:00:08Z jfclere $ */
+#include <stdio.h>
+
 #include "jsvc.h"
-#include <sys/types.h>
-#include <unistd.h>
-#include <time.h> 
 
 /* Wether debug is enabled or not */
 bool log_debug_flag = false;
@@ -28,19 +27,9 @@
 /* Dump a debug message to stderr */
 void log_debug(const char *fmt, ...) {
     va_list ap;
-    time_t now;
-    struct tm *nowtm;
-    char buff[80];
 
     if (log_debug_flag==false) return;
-    if (fmt==NULL) return;
-
-    now = time(NULL);
-    nowtm = localtime(&now);
-    strftime(buff, sizeof(buff), "%d/%m/%Y %T", nowtm);
-
     va_start(ap,fmt);
-    fprintf(stderr,"%s %d %s debug: ", buff,  getpid(), log_prog);
     vfprintf(stderr,fmt,ap);
     fprintf(stderr,"\n");
     fflush(stderr);
@@ -50,21 +39,11 @@
 /* Dump an error message to stderr */
 void log_error(const char *fmt, ...) {
     va_list ap;
-    time_t now;
-    struct tm *nowtm;
-    char buff[80];
 
     if (fmt==NULL) return;
-
-    now = time(NULL);
-    nowtm = localtime(&now);
-    strftime(buff, sizeof(buff), "%d/%m/%Y %T", nowtm);
-
     va_start(ap,fmt);
-    fprintf(stderr,"%s %d %s error: ", buff, getpid(), log_prog);
     vfprintf(stderr,fmt,ap);
     fprintf(stderr,"\n");
     fflush(stderr);
     va_end(ap);
 }
-

Modified: trunk/commons-daemon/src/native/unix/native/jsvc-unix.c
===================================================================
--- trunk/commons-daemon/src/native/unix/native/jsvc-unix.c	2007-04-23 13:22:55 UTC (rev 3310)
+++ trunk/commons-daemon/src/native/unix/native/jsvc-unix.c	2007-04-23 13:34:41 UTC (rev 3311)
@@ -654,7 +654,7 @@
                 ssize_t n = read(out_fd, buf, LOGBUF_SIZE-1);
                 if (n < 0) {
                     syslog(LOG_ERR, "read: %s", strerror(errno));
-                } else if (n > 0) {
+                } else if (n > 0 && buf[0] != '\n') {
                     buf[n] = 0;
                     syslog(LOG_INFO, "%s", buf);
                 }
@@ -663,7 +663,7 @@
                 ssize_t n = read(err_fd, buf, LOGBUF_SIZE-1);
                 if (n < 0) {
                     syslog(LOG_ERR, "read: %s", strerror(errno));
-                } else if (n > 0) {
+                } else if (n > 0 && buf[0] != '\n') {
                     buf[n] = 0;
                     syslog(LOG_ERR, "%s", buf);
                 }




More information about the pkg-java-commits mailing list