Re: [exim] not syslogging correctly

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: Mike Sturdee
CC: exim-users
Subject: Re: [exim] not syslogging correctly
On Fri, 17 Dec 2004, Mike Sturdee wrote:

> When logging to a file, the line is written correctly.


Right. That means Exim has correctly set up the long line. In that case,
when SYSLOG_LONG_LINES is set, it should just call syslog() with that
data. In the 4.43 release, around line 110 of the log.c module you
should see this:

    if (pass == 0) linecount++; else
      {                        
      if (linecount == 1)       
        syslog(priority, "%.*s", plen, ss);
      else
        syslog(priority, "[%d%c%d] %.*s", i,
          (ss[plen] == '\n' && tlen != 0)? '\\' : '/',
          linecount, plen, ss);
      }                           


The code is complicated because is it tangled up with the splitting
version. If you change that code to this:

    if (pass == 0) linecount++; else
      {                        
      if (linecount == 1)       
        {
        debug_printf("+++ Writing the following to syslog()\n");
        debug_printf("%.*s", plen, ss);   
        syslog(priority, "%.*s", plen, ss);
        } 
      else
        syslog(priority, "[%d%c%d] %.*s", i,
          (ss[plen] == '\n' && tlen != 0)? '\\' : '/',
          linecount, plen, ss);
      }                           


(two debug_printf() lines added) and then run a suitable test with
debugging (-d) turned on, the debug output will tell us whether this
problem is Exim's fault or not.


-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book:    http://www.uit.co.uk/exim-book