|PostgreSQL Reference Manual - Volume 3 - Server Administration Guide|
by The PostgreSQL Global Development Group
Paperback (6"x9"), 204 pages
RRP £13.95 ($24.95)
Sales of this book support the PostgreSQL project! Get a printed copy>>>
4.7.3 What To Log
These parameters enable various debugging output to be emitted.
For each executed query, they print
the resulting parse tree, the query rewriter output, or the
debug_pretty_printindents these displays to produce a more readable but much longer output format.
DEBUG1or lower to actually send this output to the client or the server log, respectively. These parameters are off by default.
- This outputs a line to the server log detailing each successful connection. This is off by default, although it is probably very useful. Some client programs, like psql, attempt to connect twice while determining if a password is required, so duplicate “connection received” messages do not necessarily indicate a problem. This parameter can only be set in the ‘postgresql.conf’ file or on the server command line.
This outputs a line in the server log similar to
log_connectionsbut at session termination, and includes the duration of the session. This is off by default. This parameter can only be set in the ‘postgresql.conf’ file or on the server command line.
Causes the duration of every completed statement to be logged.
The default is
off. Only superusers can change this setting. For clients using extended query protocol, durations of the Parse, Bind, and Execute steps are logged independently.
Note: The difference between setting this option and setting
log_min_duration_statementto zero is that exceeding
log_min_duration_statementforces the text of the query to be logged, but this option doesn't. Thus, if
log_min_duration_statementhas a positive value, all durations are logged but the query text is included only for statements exceeding the threshold. This behavior can be useful for gathering statistics in high-load installations.
This is a
printf-style string that is output at the beginning of each log line. The default is an empty string. Each recognized escape is replaced as outlined below - anything else that looks like an escape is ignored. Other characters are copied straight to the log line. Some escapes are only recognized by session processes, and do not apply to background processes such as the main server process. Syslog produces its own time stamp and process ID information, so you probably do not want to use those escapes if you are using syslog. This parameter can only be set in the ‘postgresql.conf’ file or on the server command line.
Escape Effect Session only
User name yes
Database name yes
Remote host name or IP address, and remote port yes
Remote host name or IP address yes
Process ID no
Time stamp (no milliseconds, no timezone on Windows) no
Time stamp with milliseconds no
Command tag: This is the command that generated the log line. yes
Session ID: A unique identifier for each session. It is 2 4-byte hexadecimal numbers (without leading zeros) separated by a dot. The numbers are the session start time and the process ID, so this can also be used as a space saving way of printing these items. yes
Number of the log line for each process, starting at 1 no
Session start time stamp yes
Transaction ID yes
Does not produce any output, but tells non-session processes to stop at this point in the string. Ignored by session processes. no
Controls which SQL statements are logged. Valid values are
ddllogs all data definition statements, such as
ddlstatements, plus data-modifying statements such as
EXPLAIN ANALYZEstatements are also logged if their contained command is of an appropriate type. For clients using extended query protocol, logging occurs when an Execute message is received, and values of the Bind parameters are included (with any embedded single-quote marks doubled). The default is
none. Only superusers can change this setting.
Note: Statements that contain simple syntax errors are not logged even by the
allsetting, because the log message is emitted only after basic parsing has been done to determine the statement type. In the case of extended query protocol, this setting likewise does not log statements that fail before the Execute phase (i.e., during parse analysis or planning). Set
ERROR(or lower) to log such statements.
- By default, connection log messages only show the IP address of the connecting host. Turning on this parameter causes logging of the host name as well. Note that depending on your host name resolution setup this might impose a non-negligible performance penalty. This parameter can only be set in the ‘postgresql.conf’ file or on the server command line.
|ISBN 0954612043||PostgreSQL Reference Manual - Volume 3 - Server Administration Guide||See the print edition|