The postmaster occasionally prints out messages which are often helpful during troubleshooting. If you wish to view debugging messages from the postmaster, you can start it with the -d option and redirect the output to the log file:
% postmaster -d > pm.log 2>&1 &If you do not wish to see these messages, you can type
% postmaster -Sand the postmaster will be "S"ilent. No ampersand ("&") is required in this case, since the postmaster automatically detaches from the terminal when -S is specified.
Note: Contributed by Massimo Dal Zotto
The optional file data/pg_options contains runtime options used by the backend to control trace messages and other backend tunable parameters. What makes this file interesting is the fact that it is re-read by a backend when it receives a SIGHUP signal, making thus possible to change run-time options on the fly without needing to restart Postgres. The options specified in this file may be debugging flags used by the trace package (backend/utils/misc/trace.c) or numeric parameters which can be used by the backend to control its behaviour. New options and parameters must be defined in backend/utils/misc/trace.c and backend/include/utils/trace.h.
pg_options can also be specified with the -T switch of Postgres:
postgres options -T "verbose=2,query,hostlookup-"
The functions used for printing errors and debug messages can now make use of the syslog(2) facility. Message printed to stdout or stderr are prefixed by a timestamp containing also the backend pid:
#timestamp #pid #message 980127.17:52:14.173  StartTransactionCommand 980127.17:52:14.174  ProcessUtility: drop table t; 980127.17:52:14.186  SIIncNumEntries: table is 70% full 980127.17:52:14.186  Async_NotifyHandler 980127.17:52:14.186  Waking up sleeping backend process 980127.19:52:14.292  Async_NotifyFrontEnd 980127.19:52:14.413  Async_NotifyFrontEnd done 980127.19:52:14.466  Async_NotifyHandler done
This format improves readability of the logs and allows people to understand exactly which backend is doing what and at which time. It also makes easier to write simple awk or perl scripts which monitor the log to detect database errors or problem, or to compute transaction time statistics.
Messages printed to syslog use the log facility LOG_LOCAL0. The use of syslog can be controlled with the syslog pg_option. Unfortunately many functions call directly printf() to print their messages to stdout or stderr and this output can't be redirected to syslog or have timestamps in it. It would be advisable that all calls to printf would be replaced with the PRINTF macro and output to stderr be changed to use EPRINTF instead so that we can control all output in a uniform way.
The format of the pg_options file is as follows:
# comment option=integer_value # set value for option option # set option = 1 option+ # set option = 1 option- # set option = 0Note that keyword can also be an abbreviation of the option name defined in backend/utils/misc/trace.c.
Refer to Using pg_options for a complete list of option keywords and possible values.