>>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 =3D 'stderr' # Valid values are combinations of
# stderr, syslog and eventlog,
# depending on platform.
# This is used when logging to stderr:
redirect_stderr =3D off # Enable capturing of stderr into log
# files
# These are only used if redirect_stderr is on:
log_directory =3D 'pg_log' # Directory where log files are written
# Can be absolute or relative to PGDATA
log_filename =3D 'postgresql-%Y-%m-%d_%H%M%S.log' # Log file name pattern.
# Can include strftime() escapes
log_truncate_on_rotation =3D 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 =3D 1440 # Automatic rotation of logfiles will
# happen after so many minutes. 0 to
# disable.
log_rotation_size =3D 10240 # Automatic rotation of logfiles will
# happen after so many kilobytes of log
# output. 0 to disable.
Thanks in advance,
Gurjeet.