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:25:46
Message-ID: 65937bea0605280425h1d06f60ft6cd15de39a115860@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)gurjeet(at)gmail(dot)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 = '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.
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andreas Heiduk 2006-05-28 13:17:18 Too many function calls in view with LEFT JOIN
Previous Message Gurjeet Singh 2006-05-28 11:21:29 Re: Win32: missing log file option for pg_ctl running as service