Help Center > > Developer Guide> Setting GUC Parameters> Error Reporting and Logging> Logging Content

Logging Content

Updated at:Jul 15, 2020 GMT+08:00

debug_pretty_print

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

Type: USERSET

Value range: Boolean

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

Default value: on

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.

Type: SUSET

Value range: Boolean

  • If this parameter is set to off, the difference between setting this parameter and setting log_min_duration_statement is that exceeding log_min_duration_statement forces the text of the query to be logged, but this parameter does not.
  • If this parameter is set to on and log_min_duration_statement has a positive value, all durations are 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: on

log_error_verbosity

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

Type: SUSET

Value range: enumerated values

  • terse indicates that the output excludes the logging of 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 logging of 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_lock_waits

Parameter description: If the time that a session used to wait 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.

Type: SUSET

Value range: Boolean

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

Default value: off

log_statement

Parameter description: Specifies whether to record SQL statements. 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).

Type: SUSET

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 the extended query protocol is used, this setting also does not log statements before the execution phase (during parse analysis or planning). 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 are recorded. The PREPARE, EXECUTE, and EXPLAIN ANALYZE statements are also recorded.

Default value: none

log_temp_files

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

Type: SUSET

Value range: an integer with the minimum value -1

  • A positive value indicates that the delete information of temporary files whose values are larger than that of log_temp_files is recorded.
  • If the parameter is set to 0, all the delete information of temporary files is recorded.
  • If the parameter is set to -1, the delete information of no temporary files is recorded.

Default value: –1

logging_module

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

Type: USERSET

Value range: a string

Default value: off. All the module logs on the server can be viewed by running show logging_module.

Setting method: First, you can run show logging_module to view which module is controllable. For example, the query output result is as follows:

1
2
3
4
show logging_module;
logging_module
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ALL,on(),off(DFS,GUC,HDFS,ORC,SLRU,MEM_CTL,AUTOVAC,CACHE,ADIO,SSL,GDS,TBLSPC,WLM,OBS,EXECUTOR,VEC_EXECUTOR,STREAM,LLVM,OPT,OPT_REWRITE,OPT_JOIN,OPT_AGG,OPT_SUBPLAN,OPT_SETOP,OPT_SKEW,UDF,COOP_ANALYZE,WLMCP,ACCELERATE,PLANHINT,PARQUET,CARBONDATA,SNAPSHOT,XACT,HANDLE,CLOG,EC,REMOTE,CN_RETRY,PLSQL,TEXTSEARCH,SEQ,INSTR,COMM_IPC,COMM_PARAM)
(1 row)

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

1
2
3
4
5
set logging_module='on(SSL)';
SET
show logging_module;                                                                                                                                              logging_module                                               
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ALL,on(SSL),off(DFS,GUC,HDFS,ORC,CARBONDATA,SLRU,MEM_CTL,AUTOVAC,CACHE,ADIO,GDS,TBLSPC,WLM,OBS,EXECUTOR,VEC_EXECUTOR,STREAM,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)
(1 row)

SSL log output is enabled.

The ALL identifier is equivalent to a shortcut operation. That is, logs of all modules can be enabled or disabled.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
set logging_module='off(ALL)';
SET
show logging_module;                                                                                                                                                logging_module                                              
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ALL,on(),off(DFS,GUC,HDFS,ORC,CARBONDATA,SLRU,MEM_CTL,AUTOVAC,CACHE,ADIO,SSL,GDS,TBLSPC,WLM,OBS,EXECUTOR,VEC_EXECUTOR,STREAM,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)
(1 row)

set logging_module='on(ALL)';
SET
show logging_module;                                                                                                                                               logging_module                                              
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ALL,on(DFS,GUC,HDFS,ORC,CARBONDATA,SLRU,MEM_CTL,AUTOVAC,CACHE,ADIO,SSL,GDS,TBLSPC,WLM,OBS,EXECUTOR,VEC_EXECUTOR,STREAM,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),off()
(1 row)

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

enable_unshipping_log

Parameter description: Specifies whether to log statements that are not pushed down. The logs help locate performance issues that may be caused by statements not pushed down.

Type: SUSET

Value range: Boolean

  • on: Statements not pushed down will be logged.
  • off: Statements not pushed down will not be logged.

Default value: on

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel