Re: [HACKERS] Log line prefix on win32 - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: [HACKERS] Log line prefix on win32
Date
Msg-id 200410090129.i991TOJ24313@candle.pha.pa.us
Whole thread Raw
List pgsql-patches
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > However, I actually prefer the mail header style of timezone to EST/EDT
> > anyway:
>
> Agreed, but AFAIK there's no portable way to ask strftime for that,
> so you're still stuck with a compatibility problem.  We could teach
> pg_strftime to do it, but that's something for 8.1 or beyond.

OK, the attached applied patch suppresses timezone output from
log_line_prefix %t on Win32.   Also added to TODO:

    Win32

        o Re-enable timezone output on log_line_prefix '%t' when a
          shorter timezone string is available


--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/backend/utils/error/elog.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/utils/error/elog.c,v
retrieving revision 1.152
diff -c -c -r1.152 elog.c
*** src/backend/utils/error/elog.c    7 Oct 2004 15:21:54 -0000    1.152
--- src/backend/utils/error/elog.c    9 Oct 2004 01:21:37 -0000
***************
*** 1391,1397 ****
--- 1391,1402 ----
                      char        strfbuf[128];

                      strftime(strfbuf, sizeof(strfbuf),
+                     /* Win32 timezone names are too long so don't print them. */
+ #ifndef WIN32
                               "%Y-%m-%d %H:%M:%S %Z",
+ #else
+                              "%Y-%m-%d %H:%M:%S",
+ #endif
                               localtime(&stamp_time));
                      appendStringInfoString(buf, strfbuf);
                  }

pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: Re: [psql] Setting the PROMPT on command line
Next
From: Bruce Momjian
Date:
Subject: Re: cast pid_t to int when using *printf