Thread: Best practices for logging from a Windows service

Best practices for logging from a Windows service

From
"Kevin Grittner"
Date:
I am looking for advice on how best to configure logging from PostgreSQL
when it is run as a Windows service.  Under Linux we allow it to log to
'stderr' and we use the pg_ctl -l switch to direct that to a file.  This
doesn't seem to be supported under Windows, so I'm looking for "best
practices" advice from those experienced in this area.

-Kevin



Re: Best practices for logging from a Windows service

From
"Magnus Hagander"
Date:
> I am looking for advice on how best to configure logging from
> PostgreSQL when it is run as a Windows service.  Under Linux
> we allow it to log to 'stderr' and we use the pg_ctl -l
> switch to direct that to a file.  This doesn't seem to be
> supported under Windows, so I'm looking for "best practices"
> advice from those experienced in this area.

If you expect to analyze the logs specifically for postgresql, use log
to file and set redirect_stderr (this is the default by the MSI
installer). This will create files in the pg_log directory.

If you want to integrate with existing log analyzers etc for windows,
set it for eventlog. This is harder if you want to do a specific
analyzer, but it'll integrate nicely with pre-existing stuff.

//Magnus