OceanBase AI Database logs are divided into seven levels, as shown in the following table. The levels are listed in descending order.
Log level |
Meaning |
|---|---|
| ERROR | Critical error. Used to record system failure information that requires troubleshooting; otherwise, the system will be unavailable. |
| WARN | Warning. The system can continue to provide services, but its behavior may not meet expectations, or serious errors may occur that require troubleshooting. |
| INFO | Information. Used to record the current system status. This information is normal. |
| EDIAG | Error Diagnosis. Diagnostic information to help troubleshoot, typically related to bugs in the OceanBase AI Database program. |
| WDIAG | Warning Diagnosis. Diagnostic information to help troubleshoot. For expected errors, OceanBase AI Database can provide fault tolerance. |
| TRACE | SQL statement-level debugging information. The number of logs is related to SQL complexity and not to the volume of data accessed. |
| DEBUG | Debugging information. Used to gain a more detailed understanding of the system's runtime status during debugging, including the current function name, parameters, variables, and return values of function calls. |
Notice
The methods for viewing and setting log levels described in this topic apply only to regular log files (election.log, observer.log, rootservice.log). For WARNING log files (files with the `.wf` suffix), logs at or above the WARN level are always printed.
You can execute the SHOW PARAMETERS statement to view the current log output level. The default log output level is WDIAG.
obclient> SHOW PARAMETERS LIKE '%syslog_level%';
The return result is as follows:
+-------+----------+----------------+----------+--------------+-----------+-------+------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+---------------+-----------+
| zone | svr_type | svr_ip | svr_port | name | data_type | value | info | section | scope | source | edit_level | default_value | isdefault |
+-------+----------+----------------+----------+--------------+-----------+-------+------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+---------------+-----------+
| zone1 | observer | 172.xx.xxx.xxx | 2882 | syslog_level | NULL | WDIAG | specifies the current level of logging. There are DEBUG, TRACE, WDIAG, EDIAG, INFO, WARN, ERROR, seven different log levels. | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE | WDIAG | 1 |
+-------+----------+----------------+----------+--------------+-----------+-------+------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+---------------+-----------+
1 row in set
OceanBase AI Database allows you to set log levels to obtain more precise logs. You can set log levels at three levels: system level, session level, and statement level. When logs are printed, the priority in descending order is statement level, session level, and system level. OceanBase AI Database also allows you to set log levels by module.
- System level: Applies to all OBServer nodes in the cluster. It can be configured only in the sys tenant.
- Session level: Applies to the OBServer node where the current tenant resides in the cluster.
- Variables set at the session level are valid only for the current session and not for other sessions.
- Variables set at the global level are not effective for the current session. They take effect only after you log out and log in again to establish a new session.
- Statement level: Applies to the OBServer node where the current statement is executed. It takes effect only during the execution of the SQL statement.
The following describes how to set log levels at the system, session, and statement levels.
Set the log level of a module at the system level.
You can use either of the following methods:
Use the system configuration item
syslog_levelto set the system-level log level. For example, you can set the log level of the SQL module todebugand that of the COMMON module toerror.obclient > ALTER SYSTEM SET syslog_level='sql.*:debug, common.*:error';Use the operating system command
bash kill -41/42 $pidto set the system-level log level.kill -41lowers the program log level. For example, if the current program log level is INFO, it is lowered to TRACE after you executekill -41.kill -42raises the program log level. For example, if the current program log level is INFO, it is raised to WARN after you executekill -42.We recommend that you use the system configuration item
syslog_levelto set the system-level log level. This is because when OceanBase AI Database refreshes its configuration, it imports thesyslog_levelsetting from theconfigfile (located in theetc/observer.config.bindirectory under the OceanBase installation directory), which makes the kill method ineffective.Notice
We recommend that you use
kill -41/kill -42to adjust the log level only when you cannot log in to the OceanBase AI Database cluster via the SQL client.
Set the log level of a module at the session level.
Use the system variable
ob_log_levelto set the log level of a module at the session level. For example, you can set the log level of the SQL module todebugand that of the COMMON module toinfo.obclient > SET @@ob_log_level='sql.*:debug, common.*:info';Set the log level of a module at the statement level.
You can use hints to set the log level of a module at the statement level. For example, you can set the log level of the SQL module to
debugand that of the COMMON module toinfo. For more information about hint statements, see Optimizer hint.obclient > SELECT /*+log_level('sql.*:debug, common.*:info')*/ * FROM t;Note
If you execute an SQL statement with hints using the MySQL C client, you must log in by using the
-coption. Otherwise, the MySQL client removes the hints from your SQL statement as comments, preventing the system from receiving the hints.