Logging Time
client_min_messages
Parameter description: Specifies the level of messages sent to the client. All messages at or above the specified level are sent.
Parameter type: enumerated type
Unit: none
Value range: The message levels are debug5, debug4, debug3, debug2, debug1, log, info, notice, warning, error, fatal, and panic in ascending order. For details about the parameters, see Table 1.
- In general, the lower the set level, the more messages will be sent to the client.
- For client log messages, if client_min_messages is set to fatal or panic, its effective value will be forcibly adjusted to error. Regardless of the level set in client_min_messages, messages at the info level are always sent to the client.
- When a client is connected to a CN, debug (debug5, debug4, debug3, debug2, and debug1) and log messages are not sent to the client due to security and performance reasons. To view these two types of logs, view the server logs of the CN.
Default value: notice
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 server logs. All messages at or above the specified level are written.
Parameter type: enumerated type
Unit: none
Value range: The message levels are debug5, debug4, debug3, debug2, debug1, log, info, notice, warning, error, fatal, and panic in ascending order. For details about the parameters, see Table 1.
- In general, the lower the set level, the more messages will be written into server logs.
- For server log messages, if log_min_messages is set to a level not higher than error, all messages at the log level will be written into server logs.
- Frequent printing affects system performance and stability. Therefore, the debug levels 1–5 are generally used for onsite fault locating. You are advised to enable these levels by module (see logging_module) and promptly reset the levels afterward.
Default value: warning
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 level of messages corresponding to SQL statements written to server logs. All SQL statements corresponding to messages at or above the specified level are written.
Parameter type: enumerated type
Unit: none
Value range: The message levels are debug5, debug4, debug3, debug2, debug1, log, info, notice, warning, error, fatal, and panic in ascending order. For details about the parameters, see Table 1.
- In general, the lower the set level, the more SQL statements will be written into server logs.
- For SQL messages in server logs, if the level is set to error or lower, the SQL statements corresponding to messages at the log level will be written into server logs.
- If an SQL statement contains personal information and you do not need to record the SQL statement that reports an error, you can set log_min_error_statement to panic.
Default value: error
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.
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: milliseconds
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 this function 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)
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 level of messages corresponding to function stack information written to server logs. All stack information corresponding to messages at or above the specified level is written.
Parameter type: enumerated type
Unit: none
Value range: The message levels are debug5, debug4, debug3, debug2, debug1, log, info, notice, warning, error, fatal, and panic in ascending order. For details about the parameters, see Table 1.
- In general, the lower the level, the more stack information is written to the server logs.
- This parameter is used to locate faults on site. Frequent printing of function stacks affects system overhead and stability. Therefore, you are advised to set backtrace_min_messages to fatal or panic during fault locating.
Default value: panic
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. If the level is too low, concurrent thread stack printing may affect service execution in high-concurrency scenarios. For example, if this parameter is set improperly when a large number of concurrent connections are established, the processing efficiency of the connection thread pool will be slowed down, or even the database instance will become unreachable.
Table 1 explains message severities used by GaussDB. When logs are output to syslog or eventlog (only in the Windows environment, this parameter is not involved in GaussDB), GaussDB performs the conversion as shown in the following table.
| 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 |
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot