The server log is just a file that records messages from the server. Each message has a severity level, the most typical of them being LOG, though there are others, as shown in the following table:
PostgreSQL severity | Meaning | Syslog severity | Windows Event Log |
DEBUG 1 to DEBUG 5 | This comprises the internal diagnostics | DEBUG | INFORMATION |
INFO | This is the command output for the user | INFO | INFORMATION |
NOTICE | This is helpful information | NOTICE | INFORMATION |
WARNING | This warns of likely problems | NOTICE | WARNING |
ERROR | This is the current command that is aborted | WARNING | ERROR |
LOG | This is useful for sysadmins | INFO | INFORMATION |
FATAL | This is the event that disconnects one session only | ERR | ERROR |
PANIC | This is the event that crashes the server | CRIT | ERROR |
Watch out for FATAL and PANIC. This shouldn't happen in most cases during normal server operation, apart from certain cases related to replication; so check out Chapter 12, Replication and Upgrades, also.
You can adjust the number of messages that appear in the log by changing the log_min_messages server parameter. You can also change the amount of information that is displayed for each event by changing the log_error_verbosity parameter. If the messages are sent to a standard log file, then each line in the log will have a prefix of useful information that can also be controlled by the system administrator, with a parameter named log_line_prefix.
You can also alter the what and the how much that goes into the logs by changing other settings such as log_statements, log_checkpoints, log_connections/log_disconnections, log_verbosity, log_lock_waits, and so on.