Re: Win32: missing log file option for pg_ctl running as service

From: "Gurjeet Singh" <singh(dot)gurjeet(at)gmail(dot)com>
To: "Magnus Hagander" <mha(at)sollentuna(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Win32: missing log file option for pg_ctl running as service
Date: 2006-05-28 11:21:29
Message-ID: 65937bea0605280421t502fa2ecp30a8ba714feea085@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

>>When running pg_ctl as a windows service (WinXP Pro), I don't
>>see any way
>>currently to configure a log file for it to use. I am using
>>the following
>>syntax to register pg_ctl as a service:
>>
>>pg_ctl register -N MyService -U myUser -P myPword -D myDataDir
>>-w -o "-i"
>>
>>A "-l myLog" option passed in would get ignored, according to
>>pg-ctl.c.
>>Is there some other way that we should be configuring a log file when
>>running pg_ctl as a service on windows?
>
>Yes, see the redirect_stderr parameter in postgresql.conf.
>It should be enabled by default in the pginstaller installation.
>
>//Magnus

Hi Magnus,

I tried what you said, but the LOG/ERROR/FATAL messages are all
getting logged into Windows (Win2k) 'Event Log', and are visible via
'Event Viewer' under 'Application Log'.

I am building from sources, and I just uncommented the GUC in
question from the conf file:

# - Where to Log -

log_destination = 'stderr' # Valid values are combinations of
# stderr, syslog and eventlog,
# depending on platform.

# This is used when logging to stderr:
redirect_stderr = off # Enable capturing of stderr into log
# files

# These are only used if redirect_stderr is on:
log_directory = 'pg_log' # Directory where log files are written
# Can be absolute or relative to PGDATA
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # Log file name pattern.
# Can include strftime() escapes
log_truncate_on_rotation = off # If on, any existing log file of the same
# name as the new log file will be
# truncated rather than appended to. But
# such truncation only occurs on
# time-driven rotation, not on restarts
# or size-driven rotation. Default is
# off, meaning append to existing files
# in all cases.
#log_rotation_age = 1440 # Automatic rotation of logfiles will
# happen after so many minutes. 0 to
# disable.
log_rotation_size = 10240 # Automatic rotation of logfiles will
# happen after so many kilobytes of log
# output. 0 to disable.

Thanks in advance,
Gurjeet.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Gurjeet Singh 2006-05-28 11:25:46 Re: Win32: missing log file option for pg_ctl running as service
Previous Message Bruce Momjian 2006-05-27 17:26:24 Re: BUG #2424: initdb Did Not Escape the Password