Project

General

Profile

Actions

Feature #481

closed

A newline is added to the syslog string

Added by Anonymous almost 19 years ago. Updated about 18 years ago.

Status:
Fixed
Priority:
Low
Category:
mod_accesslog
Target version:
-
ASK QUESTIONS IN Forums:

Description

When using syslog() the newline at the end should be stripped away. Now i get empty lines in my syslog files.

Something like this:


--- mod_accesslog.c.orig    2006-01-21 00:04:19.000000000 +0100
+++ mod_accesslog.c 2006-01-21 00:17:56.000000000 +0100
@@ -334,7 +334,7 @@
            if (s->access_logbuffer->used) {
                if (s->use_syslog) {
 # ifdef HAVE_SYSLOG_H
-                   syslog(LOG_INFO, "%*s", s->access_logbuffer->used - 1, s->access_logbuffer->ptr);
+                   syslog(LOG_INFO, "%*s", s->access_logbuffer->used - 2, s->access_logbuffer->ptr);
 # endif
                } else if (s->log_access_fd != -1) {
                    write(s->log_access_fd, s->access_logbuffer->ptr, s->access_logbuffer->used - 1);
@@ -813,7 +813,7 @@
        b->used > BUFFER_MAX_REUSE_SIZE) {
        if (p->conf.use_syslog) {
 #ifdef HAVE_SYSLOG_H
-           syslog(LOG_INFO, "%*s", b->used - 1, b->ptr);
+           syslog(LOG_INFO, "%*s", b->used - 2, b->ptr);
 #endif
        } else if (p->conf.log_access_fd != -1) {
            write(p->conf.log_access_fd, b->ptr, b->used - 1);

It seems that my syslog can handle %*s, with printf i have to use %.*s to get the string stripped. I am using the Debian GNU/Linux unstable package.

-- c00chm

Actions #1

Updated by jan almost 19 years ago

  • Status changed from New to Assigned
Actions #2

Updated by jan almost 19 years ago

  • Status changed from Assigned to Fixed
  • Resolution set to fixed

fixed in r963

Actions

Also available in: Atom