HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlModerate

Logging Postgres startup errors on Windows

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
loggingpostgreswindowserrorsstartup

Problem

I have been experimenting with Postgres configuration parameters and noticed that when I use settings that prevent Postgres from starting nothing shows up in the pg_log directory logs. I have

log_destination = 'stderr'
logging_collector = on
log_directory = 'pg_log'


Is there a way to cause Postgres to log startup errors to pg_log on Windows 7 and Postgres 9.3?

Solution

There's a chicken-and-egg problem there.

PostgreSQL reads postgresql.conf to decide where to log, and how.

So it cannot really log errors in postgresql.conf to the PostgreSQL logs, unless it uses some kind of fallback/default log.

Instead, it uses the Windows Event Log, which is what Windows applications are supposed to do anyway. (You can have PostgreSQL write all logs to the Windows Event Log if you prefer, by changing its logging configuration).

So you should look in the windows event log - see the Event Viewer - for startup issues with PostgreSQL.

Context

StackExchange Database Administrators Q#59735, answer score: 11

Revisions (0)

No revisions yet.