Re: PATCH: numeric timestamp in log_line_prefix

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: PATCH: numeric timestamp in log_line_prefix
Дата
Msg-id 20150907192719.GS2912@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: PATCH: numeric timestamp in log_line_prefix  (Fabien COELHO <coelho@cri.ensmp.fr>)
Ответы Re: PATCH: numeric timestamp in log_line_prefix  (Jeff Davis <pgsql@j-davis.com>)
Список pgsql-hackers
> +            case 'n':
> +                {
> +                    struct    timeval tv;
> +                    char    strfbuf[128];
> +
> +                    gettimeofday(&tv, NULL);
> +                    sprintf(strfbuf, "%ld.%03d", tv.tv_sec, (int)(tv.tv_usec / 1000));
> +
> +                    if (padding != 0)
> +                        appendStringInfo(buf, "%*s", padding, strfbuf);
> +                    else
> +                        appendStringInfoString(buf, strfbuf);
> +                }
> +                break;

I wonder about this separate gettimeofday() call.  We already have
formatted_log_time which is used for CSV logs and freeform log lines
(stderr/syslog); if we introduce a separate gettimeofday() call here,
and the user has %n in freeform log and CSV logging is active, the
timings will diverge occasionally.

Maybe I'm worrying over nothing, because really what use case is there
for having the two log formats enabled at the same time?  Yet somebody
went some lengths to ensure they are consistent; I think we should do
likewise here.

I'm happy to be outvoted on this, so consider this a -0.5 for this
particular implementation.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: creating extension including dependencies
Следующее
От: Petr Jelinek
Дата:
Сообщение: Re: creating extension including dependencies