Updated on 2025-05-29 GMT+08:00

Logging Time

client_min_messages

Parameter description: Specifies the level of messages sent to the client. When messages of the same or higher level are generated, these messages are sent to the client. A lower level indicates that more messages are sent to the client. This parameter can be set at the PDB level.

Value type: enumerated type

Unit: None

Value range: The message levels are debug5, debug4, debug3, debug2 (debug), debug1, log, info, notice, warning, error, fatal, and panic in ascending order. For details about the parameters, see Table 1.

  • The message level debug is equivalent to debug2.
  • If the configured level is higher than error, for example, fatal or panic, the system changes the level to error by default.

Default value: notice. In the PDB scenario, if this parameter is not set, the global settings will apply.

Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Retain the default value.

Risks and impacts of improper settings: Change the parameter value after fully understanding the parameter meaning and verifying it through testing.

log_min_messages

Parameter description: Specifies the level of messages written to the server log file. When a message of the same or higher level is generated, the message is recorded in the log file. Therefore, a lower level indicates that more messages are recorded in the run log of the server. This parameter can be set at the PDB level.

Value type: enumerated type

Unit: None

Value range: The message levels are debug5, debug4, debug3, debug2 (debug), debug1, info, notice, warning, error, log, fatal, and panic in ascending order. For details about the parameters, see Table 1.

  • The message level debug is equivalent to debug2.
  • For log_min_messages, the log message level is higher than error and lower than fatal.

Default value: warning. In the PDB scenario, if this parameter is not set, the global settings will apply.

Setting method: This is a SUSET parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Retain the default value.

Risks and impacts of improper settings: Change the parameter value after fully understanding the parameter meaning and verifying it through testing.

log_min_error_statement

Parameter description: Specifies the message level for recording error SQL statements in server logs. When messages of the same or higher level are generated, the SQL statements that generate these logs are recorded in the log file. Therefore, a lower level indicates more SQL statements are recorded in the log. This parameter can be set at the PDB level.

Value type: enumerated type

Unit: None

Value range: debug5, debug4, debug3, debug2 (debug), debug1, info, notice, warning, error, log, fatal, and panic. For details about the parameters, see Table 1.

  • The message level debug is equivalent to debug2.
  • For log_min_error_statement, the log message level is higher than error and lower than fatal. Therefore, when this parameter is set to error, the SQL statements that generate logs at the error, log, fatal, and panic levels are recorded.

Default value: error. In the PDB scenario, if this parameter is not set, the global settings will apply.

Setting method: This is a SUSET parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Retain the default value.

Risks and impacts of improper settings: Change the parameter value after fully understanding the parameter meaning and verifying it through testing.

log_min_duration_statement

Parameter description: When the execution time of an SQL statement is greater than or equal to the value of this parameter, the SQL statement and its execution time are recorded. This parameter can be set at the PDB level.

Setting log_min_duration_statement makes it easy to trace query statements that need to be optimized. For clients using extended query protocols, the time required for parsing, binding, and executing steps are logged independently.

Parameter type: Integer

Unit: millisecond

When you use this parameter together with log_statement, the SQL statements that have been logged by log_statement will not be repeatedly logged. If syslog is not used, you are advised to use log_line_prefix to record PIDs or session IDs so that statement messages and execution time messages can be associated based on PIDs or session IDs.

Value range: –1 to 2147483647

  • –1 indicates that the duration logging is disabled.
  • 0 indicates that all SQL statements and their execution time are recorded.
  • Positive integer indicates that an SQL statement and its execution time are recorded when the execution time of the SQL statement is greater than or equal to the value of this parameter.

Default value: 3000 (that is, 3s). In the PDB scenario, if this parameter is not set, the global settings will apply.

Setting method: This is a SUSET parameter. Set it based on instructions provided in Table 1. If the value is an integer, the default unit is ms. If the value contains a unit, the unit must be ms, s, min, h, or d. For example, if the value is 600 without a unit, log_min_duration_statement indicates 600 ms. If the value is 10min, log_min_duration_statement indicates 10 minutes.

Setting suggestion: Retain the default value.

Risks and impacts of improper settings: If the value is out of the range or the value contains a unit other than ms, s, min, h, and d, an error message is displayed.

backtrace_min_messages

Parameter description: Specifies the message level for printing function stack information. The function's stack information is printed to the server's log file if the information generated is at least the level specified by this parameter. This parameter can be set at the PDB level.

Value type: enumerated type

Unit: None

This parameter is used to locate problems on-site. Frequent stack printing will affect the system's overhead and stability. Therefore, you are advised not to set backtrace_min_messages to a level other than fatal and panic when locating problems.

Value range: The message levels are debug5, debug4, debug3, debug2 (debug), debug1, log, info, notice, warning, error, fatal, and panic in ascending order. For details about the parameters, see Table 1.

The message level debug is equivalent to debug2.

Default value: panic. In the PDB scenario, if this parameter is not set, the global settings will apply.

Setting method: This is a SUSET parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Retain the default value.

Risks and impacts of improper settings: Change the parameter value after fully understanding the parameter meaning and verifying it through testing.

Table 1 explains message severities used by GaussDB. If logging output is sent to syslog or eventlog, the severities are translated as shown in the table. (Note that the translation takes effect only in a Windows environment where GaussDB does not involve this parameter.)

Table 1 Message severity levels

Severity

Description

System Log

Event Log

debug[1-5]

Provides detailed debug information.

DEBUG

INFORMATION

log

Reports information of interest to administrators, for example, checkpoint activity.

INFO

INFORMATION

info

Provides information implicitly requested by users, for example, output from VACUUM VERBOSE.

INFO

INFORMATION

notice

Provides information that might be helpful to users, for example, truncation of long identifiers and index created as part of the primary key.

NOTICE

INFORMATION

warning

Provides warnings of likely problems, for example, COMMIT outside a transaction block.

NOTICE

WARNING

error

Reports an error that causes a command to terminate.

WARNING

ERROR

fatal

Reports the reason that causes a session to terminate.

ERR

ERROR

panic

Reports an error that caused all database sessions to terminate.

CRIT

ERROR