Deprecated in MySQL Shell 8.0.30. For SQL logging in MySQL Shell 8.0.30 onwards, see Section 12.4, “MySQL Shell SQL Logging”.
From MySQL Shell 8.0.18, you can include SQL statements that are executed in the course of AdminAPI operations as part of the MySQL Shell logging information. By default, MySQL Shell does not log these statements, and just logs the messages returned during the operations. Activating logging for these statements lets you observe the progress of the operations in terms of SQL execution, which can help with problem diagnosis for any errors.
When you activate logging for SQL statements from AdminAPI operations, the statements are written to the MySQL Shell application log file as informational messages, provided that the logging level is set to 5 (which is the default for MySQL Shell's logging level) or above. If an additional viewable location was specified with the logging level, the statements are sent there too. The statements are also sent to the console as verbose output if the verbose option is set to 1 or above. Any passwords included in the SQL statements are masked for logging and display and are not recorded or shown.
SQL statements executed by AdminAPI sandbox operations
(dba.deploySandboxInstance()
,
dba.startSandboxInstance()
,
dba.stopSandboxInstance()
,
dba.killSandboxInstance()
, and
dba.deleteSandboxInstance()
) are always
excluded from logging and verbose output, even if you have
activated logging for regular AdminAPI operations.
To log SQL statements executed by AdminAPI operations, choose one of these options:
Use the
--dba-log-sql
command-line option when starting MySQL Shell.Use the MySQL Shell
\option
command to set thedba.logSql
MySQL Shell configuration option. For instructions to use this command, see Section 13.4, “Configuring MySQL Shell Options”.Use the
shell.options
object to set thedba.logSql
MySQL Shell configuration option. For instructions to use this configuration interface, see Section 13.4, “Configuring MySQL Shell Options”.
The available settings for the option are follows:
- 0
Do not log SQL statements executed by AdminAPI operations. This setting is the default behavior if the option is not set on the command line or in the configuration file, and can be set to deactivate this type of logging after use if you only needed it temporarily.
- 1
Log SQL statements that are executed by AdminAPI operations, with the exceptions of
SELECT
statements,SHOW
statements, and statements executed by sandbox operations.- 2
Log SQL statements that are executed by regular AdminAPI operations in full, including
SELECT
andSHOW
statements, but do not log statements executed by sandbox operations.
If you specify the option without a value, which is permitted for
a command-line option when starting MySQL Shell
(--dba-log-sql
) but not with other methods of
setting the option, setting 1 is used.