| The PostgreSQL 9.0 Reference Manual - Volume 3 - Server Administration Guide
by The PostgreSQL Global Development Group Paperback (6"x9"), 274 pages ISBN 9781906966072 RRP £9.95 ($14.95) Sales of this book support the PostgreSQL project! Get a printed copy>>> |
4.7.2 When To Log
client_min_messages(enum)-
Controls which message levels are sent to the client.
Valid values are
DEBUG5,DEBUG4,DEBUG3,DEBUG2,DEBUG1,LOG,NOTICE,WARNING,ERROR,FATAL, andPANIC. Each level includes all the levels that follow it. The later the level, the fewer messages are sent. The default isNOTICE. Note thatLOGhas a different rank here than inlog_min_messages. log_min_messages(enum)-
Controls which message levels are written to the server log.
Valid values are
DEBUG5,DEBUG4,DEBUG3,DEBUG2,DEBUG1,INFO,NOTICE,WARNING,ERROR,LOG,FATAL, andPANIC. Each level includes all the levels that follow it. The later the level, the fewer messages are sent to the log. The default isWARNING. Note thatLOGhas a different rank here than inclient_min_messages. Only superusers can change this setting. log_min_error_statement(enum)-
Controls which SQL statements that cause an error
condition are recorded in the server log. The current
SQL statement is included in the log entry for any message of
the specified severity or higher.
Valid values are
DEBUG5,DEBUG4,DEBUG3,DEBUG2,DEBUG1,INFO,NOTICE,WARNING,ERROR,LOG,FATAL, andPANIC. The default isERROR, which means statements causing errors, log messages, fatal errors, or panics will be logged. To effectively turn off logging of failing statements, set this parameter toPANIC. Only superusers can change this setting. log_min_duration_statement(integer)-
Causes the duration of each completed statement to be logged
if the statement ran for at least the specified number of
milliseconds. Setting this to zero prints all statement durations.
Minus-one (the default) disables logging statement durations.
For example, if you set it to
250msthen all SQL statements that run 250ms or longer will be logged. Enabling this parameter can be helpful in tracking down unoptimized queries in your applications. Only superusers can change this setting. For clients using extended query protocol, durations of the Parse, Bind, and Execute steps are logged independently.Note: When using this option together with
log_statement, the text of statements that are logged because oflog_statementwill not be repeated in the duration log message. If you are not using syslog, it is recommended that you log the PID or session ID usinglog_line_prefixso that you can link the statement message to the later duration message using the process ID or session ID.
Table 4-1 explains the message
severity levels used by PostgreSQL. If logging output
is sent to syslog or Windows'
eventlog, the severity levels are translated
as shown in the table.
Table 4-1: Message severity levels
| Severity | Usage | syslog | eventlog
|
DEBUG1..DEBUG5 | Provides successively-more-detailed information for use by developers. | DEBUG | INFORMATION
|
INFO | Provides information implicitly requested by the user,
e.g., output from VACUUM VERBOSE. | INFO | INFORMATION
|
NOTICE | Provides information that might be helpful to users, e.g., notice of truncation of long identifiers. | NOTICE | INFORMATION
|
WARNING | Provides warnings of likely problems, e.g., COMMIT
outside a transaction block. | NOTICE | WARNING
|
ERROR | Reports an error that caused the current command to abort. | WARNING | ERROR
|
LOG | Reports information of interest to administrators, e.g., checkpoint activity. | INFO | INFORMATION
|
FATAL | Reports an error that caused the current session to abort. | ERR | ERROR
|
PANIC | Reports an error that caused all database sessions to abort. | CRIT | ERROR
|
| ISBN 9781906966072 | The PostgreSQL 9.0 Reference Manual - Volume 3 - Server Administration Guide | See the print edition |