• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# log
2
3
4## Command Function
5
6This command is used to set and query log configuration.
7
8
9## Syntax
10
11log level [_levelNum_]
12
13
14
15## Parameters
16
17**Table 1** Parameter description
18
19| Parameter| Description| Value Range|
20| -------- | -------- | -------- |
21| levelNum | Specifies the level of logs to print.| [0, 5] |
22
23
24## Usage Guidelines
25
26- This command can be used only after **LOSCFG_SHELL_LK** is enabled. Before using this command, set **Enable Shell lk** to **Yes** on **menuconfig**.
27  **Debug** ---> **Enable a Debug Version** ---> **Enable Shell** ---> **Enable Shell lK**
28
29- The **log level** command sets the log level, which can be any of the following:
30  TRACE_EMG = 0,
31
32  TRACE_COMMON = 1,
33
34  TRACE_ERROR = 2,
35
36  TRACE_WARN = 3,
37
38  TRACE_INFO = 4,
39
40  TRACE_DEBUG = 5
41
42  If the log level specified is not within the value range, a message will be displayed.
43
44- If **[levelNum]** is not specified, this command displays the current log level and how to use it.
45
46- If the log level is set to **4** or **5** in the source code of an OpenHarmony small system, a large number of logs will be printed.
47
48
49## Example
50
51Run **log level 3**.
52
53
54## Output
55
56The log print level is set to WARN.
57
58
59```
60OHOS # log level 3
61Set current log level WARN
62```
63