Re: Lost logs with csvlog redirected to stderr under WIN32 service - Mailing list pgsql-hackers

From Chris Bandy
Subject Re: Lost logs with csvlog redirected to stderr under WIN32 service
Date
Msg-id 30a3cd02-5fc3-4956-1dbb-05bee26be158@gmail.com
Whole thread Raw
In response to Lost logs with csvlog redirected to stderr under WIN32 service  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Lost logs with csvlog redirected to stderr under WIN32 service
List pgsql-hackers
On 10/6/21 12:10 AM, Michael Paquier wrote:
> I have thought about various ways to
> fix that, and finished with a solution where we handle csvlog first,
> and fallback to stderr after so as there is only one code path for
> stderr, as of the attached.  This reduces a bit the confusion around
> the handling of the stderr data that gets free()'d in more code paths
> than really needed.

I don't have a windows machine to test, but this refactor looks good to me.

> +    /* Write to CSV log, if enabled */
> +    if ((Log_destination & LOG_DESTINATION_CSVLOG) != 0)

This was originally "if (Log_destination & LOG_DESTINATION_CSVLOG)" and
other conditions nearby still lack the "!= 0". Whatever the preferred
style, the lines touched by this patch should probably do this consistently.

-- Chris



pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: strange case of "if ((a & b))"
Next
From: "kuroda.hayato@fujitsu.com"
Date:
Subject: RE: Allow escape in application_name