42
42
*
43
43
*
44
44
* IDENTIFICATION
45
- * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.160 2005/06/10 16:23:10 neilc Exp $
45
+ * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.161 2005/06/10 20:48:54 tgl Exp $
46
46
*
47
47
*-------------------------------------------------------------------------
48
48
*/
@@ -1333,10 +1333,7 @@ log_line_prefix(StringInfo buf)
1333
1333
/* go to char after '%' */
1334
1334
i ++ ;
1335
1335
if (i >= format_len )
1336
- {
1337
- /* format error - ignore it */
1338
- break ;
1339
- }
1336
+ break ; /* format error - ignore it */
1340
1337
1341
1338
/* process the option */
1342
1339
switch (Log_line_prefix [i ])
@@ -1377,8 +1374,18 @@ log_line_prefix(StringInfo buf)
1377
1374
break ;
1378
1375
case 'm' :
1379
1376
{
1377
+ /*
1378
+ * Note: for %m, %t, and %s we deliberately use the
1379
+ * C library's strftime/localtime, and not the
1380
+ * equivalent functions from src/timezone. This
1381
+ * ensures that all backends will report log entries
1382
+ * in the same timezone, namely whatever C-library
1383
+ * setting they inherit from the postmaster. If we
1384
+ * used src/timezone then local settings of the
1385
+ * TimeZone GUC variable would confuse the log.
1386
+ */
1380
1387
time_t stamp_time ;
1381
- char strfbuf [128 ], msbuf [5 ];
1388
+ char strfbuf [128 ], msbuf [8 ];
1382
1389
struct timeval tv ;
1383
1390
1384
1391
gettimeofday (& tv , NULL );
@@ -1388,32 +1395,21 @@ log_line_prefix(StringInfo buf)
1388
1395
/* leave room for milliseconds... */
1389
1396
/* Win32 timezone names are too long so don't print them. */
1390
1397
#ifndef WIN32
1391
- "%Y-%m-%d %H:%M:%S %Z" ,
1398
+ "%Y-%m-%d %H:%M:%S %Z" ,
1392
1399
#else
1393
- "%Y-%m-%d %H:%M:%S " ,
1400
+ "%Y-%m-%d %H:%M:%S " ,
1394
1401
#endif
1395
- localtime (& stamp_time ));
1402
+ localtime (& stamp_time ));
1396
1403
1397
1404
/* 'paste' milliseconds into place... */
1398
- sprintf (msbuf , ".%03d" ,
1399
- (int )(tv .tv_usec /1000 ));
1405
+ sprintf (msbuf , ".%03d" , (int ) (tv .tv_usec /1000 ));
1400
1406
strncpy (strfbuf + 19 , msbuf , 4 );
1401
1407
1402
1408
appendStringInfoString (buf , strfbuf );
1403
1409
}
1404
1410
break ;
1405
1411
case 't' :
1406
1412
{
1407
- /*
1408
- * Note: for %t and %s we deliberately use the C
1409
- * library's strftime/localtime, and not the
1410
- * equivalent functions from src/timezone. This
1411
- * ensures that all backends will report log entries
1412
- * in the same timezone, namely whatever C-library
1413
- * setting they inherit from the postmaster. If we
1414
- * used src/timezone then local settings of the
1415
- * TimeZone GUC variable would confuse the log.
1416
- */
1417
1413
time_t stamp_time = time (NULL );
1418
1414
char strfbuf [128 ];
1419
1415
0 commit comments