HomeMogDBMogDB StackUqbar
v1.1

Documentation:v1.1

Supported Versions:

Other Versions:

Logging Content

debug_print_parse

Parameter description: Specifies whether to print parsing tree results.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: Boolean

  • on indicates that the printing is enabled.
  • off indicates that the printing is disabled.

Default value: off

debug_print_rewritten

Parameter description: Specifies whether to print query rewriting results.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: Boolean

  • on indicates that the printing is enabled.
  • off indicates that the printing is disabled.

Default value: off

debug_print_plan

Parameter description: Specifies whether to print query execution results.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: Boolean

  • on indicates that the printing is enabled.
  • off indicates that the printing is disabled.

Default value: off

img NOTICE:

  • Debugging information about debug_print_parse, debug_print_rewritten, and debug_print_plan are printed only when the log level is set to log or higher. When these parameters are set to on, their debugging information will be recorded in server logs and will not be sent to client logs. You can change the log level by setting client_min_messages and log_min_messages.
  • Do not invoke the gs_encrypt_aes128 and gs_decrypt_aes128 functions when debug_print_plan is set to on, preventing the risk of sensitive information disclosure. You are advised to filter parameter information of the gs_encrypt_aes128 and gs_decrypt_aes128 functions in the log files generated when debug_print_plan is set to on before providing the log files to external maintenance engineers for fault locating. After you finish using the logs, delete them as soon as possible.

debug_pretty_print

Parameter description: Indents the logs produced by debug_print_parse, debug_print_rewritten, and debug_print_plan. The output format is more readable but much longer than that generated when this parameter is set to off.

This parameter is a USERSET parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: Boolean

  • on indicates that the indentation is enabled.
  • off indicates that the indentation is disabled.

Default value: on

log_checkpoints

Parameter description: Specifies whether the statistics on checkpoints and restart points are recorded in the server logs. When this parameter is set to on, statistics on checkpoints and restart points are recorded in the log messages, including the number of buffers written and the time spent in writing them.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: Boolean

  • on indicates that the statistics on checkpoints and restart points are recorded in the server logs.
  • off indicates that the statistics on checkpoints and restart points are not recorded in the server logs.

Default value: off

log_connections

Parameter description: Specifies whether to record connection request information of the client.

This parameter is a BACKEND parameter. Set it based on instructions provided in Table 1 GUC parameters.

img NOTICE: Some client programs, such as gsql, attempt to connect twice while determining if a password is required. In this case, duplicate "connection receive" messages do not necessarily indicate a problem.

Value range: Boolean

  • on indicates that the request information is recorded.
  • off indicates that the request information is not recorded.

Default value: off

log_disconnections

Parameter description: Specifies whether to record disconnection request information of the client.

This parameter is a BACKEND parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: Boolean

  • on indicates that the request information is recorded.
  • off indicates that the request information is not recorded.

Default value: off

log_duration

Parameter description: Specifies whether to record the duration of every completed SQL statement. For clients using extended query protocols, the time required for parsing, binding, and executing steps are logged independently.

This parameter is a SUSET parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: Boolean

  • This option records the query duration whereas log_min_duration_statement logs both the duration and text of a query that exceeds the value set by log_min_duration_statement.
  • If this parameter is set to on and log_min_duration_statement is set to a positive value, the duration of each completed statement is logged but the query text is included only for statements exceeding the threshold. This behavior can be used for gathering statistics in high-load situation.

Default value: off

log_error_verbosity

Parameter description: Specifies the amount of detail written in the server log for each message that is logged.

This parameter is a SUSET parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: enumerated values

  • terse indicates that the output excludes the DETAIL, HINT, QUERY, and CONTEXT error information.
  • verbose indicates that the output includes the SQLSTATE error code, the source code file name, function name, and number of the line in which the error occurs.
  • default indicates that the output includes the DETAIL, HINT, QUERY, and CONTEXT error information, and excludes the SQLSTATE error code, the source code file name, function name, and number of the line in which the error occurs.

Default value: default

log_hostname

Parameter description: By default, connection log messages only show the IP address of the connecting host. The host name can be recorded when this parameter is set to on. It may take some time to parse the host name. Therefore, the database performance may be affected.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: Boolean

  • on indicates that the host name is simultaneously recorded.
  • off indicates that the host name is not simultaneously recorded.

Default value: on

log_line_prefix

Parameter description: Specifies the prefix format of each log information. A prefix is a printf-style string that is output at the beginning of each line of the log. The "escape sequences" which begin with % are replaced with status information as listed in [Table 1](#Escape characters).

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 GUC parameters.

Table 1 Escape characters

Escape Character Effect
%a Application name
%u Username
%d Database name
%r Remote host name or IP address and remote port. If log_hostname is set to off, only the IP address and remote port are displayed.
%h Remote host name or IP address. If log_hostname is set to off, only the IP address is displayed.
%p Thread ID
%t Time stamp without milliseconds
%m Time stamp with milliseconds
%n Node from which an error is reported
%i Command tag: type of command executed in the current session
%e SQLSTATE error code
%c Session ID: For details, see the note below the table.
%l Number of the log line for each session or thread, starting at 1
%s Process startup time
%v Virtual transaction ID (backendID/ localXID)
%x Transaction ID (0 indicates that no transaction ID is assigned)
%q Produces no output. If the current thread is a backend thread, this escape sequence is ignored and subsequent escape sequences are processed. Otherwise, this escape sequence and subsequent escape sequences are all ignored.
%% The character %

The %c escape character prints a unique session ID consisting of two 4-byte hexadecimal numbers separated by a period (.). The numbers are the process startup time and the process ID. Therefore, %c can also be used as a space saving way of printing those items. For example, run the following query to generate the session ID from pg_stat_activity:

SELECT to_hex(EXTRACT(EPOCH FROM backend_start)::integer) || '.' ||
       to_hex(pid)
FROM pg_stat_activity;
  • If you set a nonempty value for log_line_prefix, you should usually make its last character be a space, to provide visual separation from the rest of the log line. A punctuation character can be used, too.
  • Syslog generates its own time stamp and process ID information. Therefore, you do not need to include those escapes characters when you are logging in to syslog.

Value range: a string

Default value: %m %c %d %p %a %x %n %e

img NOTE: The default value will be changed when gs_initdb is used to set system environments.

%m %c %d %p %a %x %n %e indicates that session timestamps, session IDs, database names, thread IDs, application names, transaction IDs, error reporting nodes, and SQLSTATE error codes will be added to the beginning of log lines.

log_lock_waits

Parameter description: If the time for which a session waits to acquire a lock is longer than the value of deadlock_timeout, this parameter specifies whether to record this message in the database. This is useful in determining if lock waits are causing poor performance.

This parameter is a SUSET parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: Boolean

  • on indicates that the information is recorded.
  • off indicates that the information is not recorded.

Default value: off

log_statement

Parameter description: Specifies which SQL statements are recorded. For clients using extended query protocols, logging occurs when an Execute message is received, and values of the Bind parameters are included (with any embedded single quotation marks doubled).

This parameter is a SUSET parameter. Set it based on instructions provided in Table 1 GUC parameters.

img NOTICE: Statements that contain simple syntax errors are not logged even if log_statement is set to all, because the log message is emitted only after basic parsing has been completed to determine the statement type. If an extended query protocol is used, statements that fail before the execution phase (during parse analysis or planning) are not logged, either. Set log_min_error_statement to ERROR or lower to log such statements.

Value range: enumerated values

  • none indicates that no statement is recorded.
  • ddl indicates that all data definition statements, such as CREATE, ALTER, and DROP, are recorded.
  • mod indicates that all DDL statements and data modification statements, such as INSERT, UPDATE, DELETE, TRUNCATE, and COPY FROM, are recorded.
  • all indicates that all statements, including the PREPARE, EXECUTE, and EXPLAIN ANALYZE statements, are recorded.

Default value: none

log_temp_files

Parameter description: Specifies whether to record the deletion information of temporary files. Temporary files can be created for sorting, hashing, and storing temporary querying results. If the recording is enabled, a log entry is generated for each temporary file when it is deleted.

This parameter is a SUSET parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: an integer ranging from -1 to 2147483647. The unit is KB.

  • A positive value indicates that the deletion information of temporary files whose size is larger than the specified value of log_temp_files is recorded.
  • 0 indicates that the delete information of all temporary files is recorded.
  • -1 indicates that the delete information of any temporary files is not recorded.

Default value: -1

log_timezone

Parameter description: Specifies the time zone used for timestamps written in the server log. Different from TimeZone, this parameter takes effect for all sessions in the database.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: a string

Default value: PRC

img NOTE: The default value will be changed when gs_initdb is used to set system environments.

logging_module

Parameter description: Specifies whether module logs are output on the server. This parameter is a session-level parameter, and you are advised not to use the gs_guc tool to set it.

This parameter is a USERSET parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: a string

Default value: off. All the module logs are not output on the server. You can view the logs by running show logging_module. Example modules are displayed as follows: ALL,on(),off(DFS,GUC,ORC,SLRU,MEM_CTL,AUTOVAC,CACHE,ADIO,SSL,TBLSPC,WLM,EXECUTOR,OPFUSION,VEC_EXECUTOR,LLVM,OPT,OPT_REWRITE,OPT_JOIN,OPT_AGG,OPT_SUBPLAN,OPT_SETOP,OPT_SKEW,UDF,COOP_ANALYZE,WLMCP,ACCELERATE,,PLANHINT,SNAPSHOT,XACT,HANDLE,CLOG,EC,REMOTE,CN_RETRY,PLSQL,TEXTSEARCH,SEQ,REDO,FUNCTION,PARSER,INSTR,INCRE_CKPT,DBL_WRT,RTO,HEARTBEAT).

Setting method: Run show logging_module to view which modules are controllable. For example, the query output result is as follows:

mogdb=# show logging_module;
logging_module
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ALL,on(),off(DFS,GUC,ORC,SLRU,MEM_CTL,AUTOVAC,CACHE,ADIO,SSL,TBLSPC,WLM,EXECUTOR,VEC_EXECUTOR,LLVM,OPT,OPT_REWRITE,OPT_JOIN,OPT_AGG,OPT_SUBPLAN,OPT_SETOP,OPT_SKEW,UDF,COOP_ANALYZE,WLMCP,ACCELERATE,T,PLANHINT,SNAPSHOT,XACT,HANDLE,CLOG,EC,REMOTE,CN_RETRY,PLSQL,TEXTSEARCH,SEQ,REDO,FUNCTION,PARSER,INSTR,INCRE_CKPT,DBL_WRT,RTO,HEARTBEAT)
(1 row)

Controllable modules are identified by uppercase letters, and the special ID ALL is used for setting all module logs. You can control the output of module logs by setting logging_module to on or off. Enable log output for SSL:

mogdb=# set logging_module='on(SSL)';
SET
mogdb=# show logging_module;                                                                                                                                              logging_module
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ALL,on(SSL),off(DFS,GUC,ORC,SLRU,MEM_CTL,AUTOVAC,CACHE,ADIO,TBLSPC,WLM,EXECUTOR,VEC_EXECUTOR,LLVM,OPT,OPT_REWRITE,OPT_JOIN,OPT_AGG,OPT_SUBPLAN,OPT_SETOP,OPT_SKEW,UDF,COOP_ANALYZE,WLMCP,ACCELERATE,,PLANHINT,SNAPSHOT,XACT,HANDLE,CLOG,EC,REMOTE,CN_RETRY,PLSQL,TEXTSEARCH,SEQ,REDO,FUNCTION,PARSER,INSTR,INCRE_CKPT,DBL_WRT,RTO,HEARTBEAT,COMM_IPC,COMM_PARAM)
(1 row)

SSL log output is enabled.

The ALL identifier can be used to quickly enable or disable log output for all modules.

mogdb=# set logging_module='off(ALL)';
SET
mogdb=# show logging_module;                                                                                                                                                logging_module
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ALL,on(),off(DFS,GUC,ORC,SLRU,MEM_CTL,AUTOVAC,CACHE,ADIO,SSL,TBLSPC,WLM,EXECUTOR,VEC_EXECUTOR,LLVM,OPT,OPT_REWRITE,OPT_JOIN,OPT_AGG,OPT_SUBPLAN,OPT_SETOP,OPT_SKEW,UDF,COOP_ANALYZE,WLMCP,ACCELERATE,PLANHINT,SNAPSHOT,XACT,HANDLE,CLOG,EC,REMOTE,CN_RETRY,PLSQL,TEXTSEARCH,SEQ,REDO,FUNCTION,PARSER,INSTR,INCRE_CKPT,DBL_WRT,RTO,HEARTBEAT)
(1 row)

mogdb=# set logging_module='on(ALL)';
SET
mogdb=# show logging_module;                                                                                                                                               logging_module
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ALL,on(DFS,GUC,ORC,SLRU,MEM_CTL,AUTOVAC,CACHE,ADIO,SSL,TBLSPC,WLM,EXECUTOR,VEC_EXECUTOR,LLVM,OPT,OPT_REWRITE,OPT_JOIN,OPT_AGG,OPT_SUBPLAN,OPT_SETOP,OPT_SKEW,UDF,COOP_ANALYZE,WLMCP,ACCELERATE,PLANHINT,SNAPSHOT,XACT,HANDLE,CLOG,EC,REMOTE,CN_RETRY,PLSQL,TEXTSEARCH,SEQ,REDO,FUNCTION,PARSER,INSTR,INCRE_CKPT,DBL_WRT,RTO,HEARTBEAT),off()
(1 row)

Dependency: The value of this parameter depends on the settings of log_min_messages.

opfusion_debug_mode

Parameter description: Checks whether simple queries are optimized for debugging. If this parameter is set to log, you can view the specific reasons why queries are not optimized in the execution plans of database nodes.

This parameter is a USERSET parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: enumerated values

  • off indicates that reasons why queries are not optimized are not included.
  • log indicates that reasons why queries are not optimized are included in the execution plans of database nodes.

img NOTICE: To view the reasons why queries are not optimized in the log, set opfusion_debug_mode to log, log_min_messages to debug4, and logging_module to on(OPFUSION). Note that a large amount of log messages may be generated. Therefore, execute only a small number of jobs during debugging.

Default value: off

Copyright © 2011-2024 www.enmotech.com All rights reserved.