Re: query log corrupted-looking entries - Mailing list pgsql-general

From Tom Lane
Subject Re: query log corrupted-looking entries
Date
Msg-id 24885.1180736713@sss.pgh.pa.us
Whole thread Raw
In response to Re: query log corrupted-looking entries  ("George Pavlov" <gpavlov@mynewplace.com>)
Responses Re: query log corrupted-looking entries  ("George Pavlov" <gpavlov@mynewplace.com>)
List pgsql-general
"George Pavlov" <gpavlov@mynewplace.com> writes:
>> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]=20
>> What *exactly* is the logging setup you guys use, and have you tried
>> alternatives?

> ... Also redirect_stderr = on.

Hm.  Well, that's the bit that ought to get you into the PIPE_BUF
exception.  There's been some speculation that a change like the
attached would help.  I've found that it makes no difference with
my libc, but maybe yours is different --- want to try it?

            regards, tom lane

*** src/backend/utils/error/elog.c.orig    Thu May  3 22:01:02 2007
--- src/backend/utils/error/elog.c    Fri Jun  1 18:22:49 2007
***************
*** 1788,1794 ****
              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 */
--- 1788,1794 ----
              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 */
***************
*** 2120,2125 ****
--- 2120,2126 ----
  #ifndef WIN32
      /* On Unix, we just fprintf to stderr */
      vfprintf(stderr, fmt, ap);
+     fflush(stderr);
  #else

      /*

pgsql-general by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: Slightly OT.
Next
From: Robert Fitzpatrick
Date:
Subject: Re: Restoring 8.2 to 8.0