log

Command Function

This command is used to set and query log configuration.

Syntax

log level [levelNum]

Parameters

Table 1 Parameter description

Parameter

Description

Value Range

levelNum

Specifies the level of logs to print.

[0,5]

Usage

  • This command depends on LOSCFG_SHELL_LK. Before using this command, select Enable Shell lk on menuconfig.

    Debug ---> Enable a Debug Version ---> Enable Shell ---> Enable Shell lK

  • The log level command is used to set the log level, which can be any of the following:

    TRACE_EMG = 0,

    TRACE_COMMON = 1,

    TRACE_ERROR = 2,

    TRACE_WARN = 3,

    TRACE_INFO = 4,

    TRACE_DEBUG = 5

    If the log level specified is not within the value range, a message will be displayed.

  • If [levelNum] is not specified, this command queries the current log level. The usage method is also displayed.

  • If the log level is set to 4 or 5 in the source code of the open-source small system, a large number of logs will be printed.

Example

Run log level 3.

Output

Setting the log print level to WARN:

OHOS # log level 3
Set current log level WARN