Обсуждение: pgsql: Support configurable eventlog application names on Windows

Поиск
Список
Период
Сортировка

pgsql: Support configurable eventlog application names on Windows

От
Magnus Hagander
Дата:
Support configurable eventlog application names on Windows

This allows different instances to use the eventlog with different
identifiers, by setting the event_source GUC, similar to how
syslog_ident works.

Original patch by MauMau, heavily modified by Magnus Hagander

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/d8ea33f2c02721c89c2434b9fda170afb7fe4999

Modified Files
--------------
doc/src/sgml/config.sgml                      |   25 +++++++++++
doc/src/sgml/installation.sgml                |   13 ------
doc/src/sgml/runtime.sgml                     |   46 +++++++++++++++++++
src/backend/utils/error/elog.c                |    3 +-
src/backend/utils/misc/guc.c                  |   14 ++++++
src/backend/utils/misc/postgresql.conf.sample |    2 +
src/bin/pgevent/pgevent.c                     |   58 ++++++++++++++++++++++--
src/bin/pgevent/pgevent.def                   |    1 +
8 files changed, 143 insertions(+), 19 deletions(-)


Re: pgsql: Support configurable eventlog application names on Windows

От
Jaime Casanova
Дата:
On Tue, Oct 25, 2011 at 1:05 PM, Magnus Hagander <magnus@hagander.net> wrote:
> Support configurable eventlog application names on Windows
>
> This allows different instances to use the eventlog with different
> identifiers, by setting the event_source GUC, similar to how
> syslog_ident works.
>

if i uncomment event_source in a linux env i get this error:
"""
LOG:  unrecognized configuration parameter "event_source" in file
"/usr/local/pgsql/9.2/data/postgresql.conf" line 326
FATAL:  configuration file "/usr/local/pgsql/9.2/data/postgresql.conf"
contains errors
"""

this is because the definition of the GUC is inside an #ifdef, but the
error message is not very informative...
so, i tried to add a check_event_source (attached) and the error now
looks like this

"""
LOG:  22023: event_source can only be setted in windows builds
LOCATION:  call_string_check_hook, guc.c:8172
FATAL:  XX000: failed to initialize event_source to "PostgreSQL"
LOCATION:  InitializeOneGUCOption, guc.c:3959
"""

--
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación

Вложения

Re: pgsql: Support configurable eventlog application names on Windows

От
Magnus Hagander
Дата:
On Tue, Oct 25, 2011 at 22:21, Jaime Casanova <jaime@2ndquadrant.com> wrote:
> On Tue, Oct 25, 2011 at 1:05 PM, Magnus Hagander <magnus@hagander.net> wrote:
>> Support configurable eventlog application names on Windows
>>
>> This allows different instances to use the eventlog with different
>> identifiers, by setting the event_source GUC, similar to how
>> syslog_ident works.
>>
>
> if i uncomment event_source in a linux env i get this error:
> """
> LOG:  unrecognized configuration parameter "event_source" in file
> "/usr/local/pgsql/9.2/data/postgresql.conf" line 326
> FATAL:  configuration file "/usr/local/pgsql/9.2/data/postgresql.conf"
> contains errors
> """
>
> this is because the definition of the GUC is inside an #ifdef, but the
> error message is not very informative...
> so, i tried to add a check_event_source (attached) and the error now
> looks like this
>
> """
> LOG:  22023: event_source can only be setted in windows builds
> LOCATION:  call_string_check_hook, guc.c:8172
> FATAL:  XX000: failed to initialize event_source to "PostgreSQL"
> LOCATION:  InitializeOneGUCOption, guc.c:3959
> """


Ugh, you are right. I thought I had fixed that, but it seems not. Will fix.

I think the proper fix is to just remove the #ifdef though. There's
precedent with e.g. syslog_ident, that we just ignore the setting if
it's not supported on that platform.

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

Re: pgsql: Support configurable eventlog application names on Windows

От
Tom Lane
Дата:
Magnus Hagander <magnus@hagander.net> writes:
> Support configurable eventlog application names on Windows

Some of the buildfarm members still don't like this patch ...

            regards, tom lane

Re: pgsql: Support configurable eventlog application names on Windows

От
Heikki Linnakangas
Дата:
On 25.10.2011 21:05, Magnus Hagander wrote:
> Support configurable eventlog application names on Windows
>
> This allows different instances to use the eventlog with different
> identifiers, by setting the event_source GUC, similar to how
> syslog_ident works.
>
> Original patch by MauMau, heavily modified by Magnus Hagander

Looks like the MinGw build didn't like this. Per frogmouth:

pgevent.o: In function `DllInstall':
c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.3916/../pgsql/src/bin/pgevent/pgevent.c:48:
undefined reference to `wcstombs_s'

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

Re: pgsql: Support configurable eventlog application names on Windows

От
Magnus Hagander
Дата:
On Wed, Oct 26, 2011 at 16:41, Heikki Linnakangas
<heikki.linnakangas@enterprisedb.com> wrote:
> On 25.10.2011 21:05, Magnus Hagander wrote:
>>
>> Support configurable eventlog application names on Windows
>>
>> This allows different instances to use the eventlog with different
>> identifiers, by setting the event_source GUC, similar to how
>> syslog_ident works.
>>
>> Original patch by MauMau, heavily modified by Magnus Hagander
>
> Looks like the MinGw build didn't like this. Per frogmouth:
>
> pgevent.o: In function `DllInstall':
> c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.3916/../pgsql/src/bin/pgevent/pgevent.c:48:
> undefined reference to `wcstombs_s'

Ugh. Seems MingW doesn't support this basic API, which seems to have
been added in Windows 95..

Will fix.

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/