Re: Win32: missing log file option for pg_ctl running as service - Mailing list pgsql-bugs

From Gurjeet Singh
Subject Re: Win32: missing log file option for pg_ctl running as service
Date
Msg-id 65937bea0605280425h1d06f60ft6cd15de39a115860@mail.gmail.com
Whole thread Raw
In response to Re: Win32: missing log file option for pg_ctl running as service  ("Gurjeet Singh" <singh.gurjeet@gmail.com>)
List pgsql-bugs
Reference (http://archives.postgresql.org/pgsql-bugs/2004-09/msg00185.php).
Also, I am regsitering the service as follows:

...> pg_ctl register -N postgres -U username -P passwd -D F:\pgsql\data

    I can connect to the cluster using psql and work just normally.
But wish to redirect the log entries to a FS log fle instead of OS
event log!!!

Thanks,
Gurjeet.

On 5/28/06, Gurjeet Singh <singh.gurjeet@gmail.com> wrote:
> >>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 in=
to 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 sa=
me
>                                         # name as the new log file will be
>                                         # truncated rather than appended =
to. But
>                                         # such truncation only occurs on
>                                         # time-driven rotation, not on re=
starts
>                                         # or size-driven rotation. Defaul=
t is
>                                         # off, meaning append to existing=
 files
>                                         # in all cases.
> #log_rotation_age =3D 1440                # Automatic rotation of logfile=
s will
>                                         # happen after so many minutes.  =
0 to
>                                         # disable.
> log_rotation_size =3D 10240               # Automatic rotation of logfile=
s will
>                                         # happen after so many kilobytes =
of log
>                                         # output.  0 to disable.
>
> Thanks in advance,
> Gurjeet.
>

pgsql-bugs by date:

Previous
From: "Gurjeet Singh"
Date:
Subject: Re: Win32: missing log file option for pg_ctl running as service
Next
From: imacat
Date:
Subject: Re: BUG #2424: initdb Did Not Escape the Password