View Single Post

   
  #7 (permalink)  
Old 04-12-2008, 09:11 AM
Tom Lane
 
Posts: n/a
Default Re: "Garbled" postgres logs

tgoodair@ca.afilias.info (Tim Goodaire) writes:
> I've compared the libc and kernel versions between a misbehaving machine and a
> machine that is logging properly and they're the same:


[ scratches head... ] So what's different?

Anyway, if you are interested in trying to cut libc out of the equation,
the patch I had in mind goes like this (against 8.1)

regards, tom lane


*** src/backend/utils/error/elog.c.orig Thu Feb 22 03:11:50 2007
--- src/backend/utils/error/elog.c Thu Apr 5 12:03:57 2007
***************
*** 1710,1716 ****
write_eventlog(edata->elevel, buf.data);
else
#endif
! fprintf(stderr, "%s", buf.data);
}

/* If in the syslogger process, try to write messages direct to file */
--- 1710,1716 ----
write_eventlog(edata->elevel, buf.data);
else
#endif
! write(fileno(stderr), buf.data, buf.len);
}

/* If in the syslogger process, try to write messages direct to file */
***************
*** 2043,2048 ****
--- 2043,2049 ----
#ifndef WIN32
/* On Unix, we just fprintf to stderr */
vfprintf(stderr, fmt, ap);
+ fflush(stderr);
#else

/*
***************
*** 2058,2065 ****
--- 2059,2069 ----
write_eventlog(EVENTLOG_ERROR_TYPE, errbuf);
}
else
+ {
/* Not running as service, write to stderr */
vfprintf(stderr, fmt, ap);
+ fflush(stderr);
+ }
#endif
va_end(ap);
}


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply With Quote