C.7. Configuring SQL Command Logging (axe.set_log_statement) #

The axe.set_log_statement stored procedure specifies the types of SQL commands that are written to the server log by updating the log_statement configuration parameter for the current session.

Important

Execute this stored procedure outside a transaction block.

Required privileges: Superuser or the Postgres Pro AXE administrator with the SET privilege on the log_statement configuration parameter.

The stored procedure is executed with the privileges of the current user.

For more information about access management, refer to Chapter 12.

Execute the following command on the Postgres Pro AXE server:

  SELECT axe.set_log_statement('mode');

Where mode is the logging mode.

Possible values:

  • none: Disables logging of SQL commands.

    Other logging mechanisms are configured separately.

  • ddl: Logs all DDL commands, such as CREATE, ALTER, and DROP.

  • mod: Logs all DDL commands plus data-modifying commands, including INSERT, UPDATE, DELETE, TRUNCATE, and COPY FROM.

  • all: Logs all SQL commands, including SELECT.

You must specify the value in lowercase characters, without leading and trailing spaces. For example, 'ALL', ' all ', and the empty string are invalid. Do not pass NULL.

The value persists until you update it, reset it with the RESET command, or terminate the session. Other sessions are not affected.

Example C.2. Configuring SQL Command Logging

To enable logging of all SQL commands:

  SELECT axe.set_log_statement('all');

To verify the result:

  SHOW log_statement;

To disable logging of SQL commands:

  SELECT axe.set_log_statement('none');

FAQ