README.rst
1.. _acrnlog:
2
3Acrnlog
4#######
5
6Description
7***********
8
9``acrnlog`` is a userland tool used to capture an ACRN hypervisor log. It runs
10as a Service VM service at boot, capturing two kinds of logs:
11
12- log of the running hypervisor
13- log of the last running hypervisor if it crashed and the logs remain
14
15Log files are saved in ``/var/log/acrnlog/``, so the log files would be lost
16after a system reset.
17
18Usage
19*****
20
21The ``acrnlog`` tool is launched as a service at boot, and limited to
22supporting four 1MB log files by default. You can change this log file
23limitation temporarily or permanently.
24
25Options:
26
27 -h display help
28 -t specify a polling interval (ms). Once buffer is empty, acrnlog stops
29 and starts reading in specified interval.
30 If an incomplete log warning is reported, please try with a smaller
31 interval to get a complete log.
32 -s limit the size of each log file, in KB. 0 means no limitation.
33 -n specify the number of log files to keep, old files would be deleted.
34
35Temporary Log File Changes
36==========================
37
38You can temporarily change the log file setting by following these
39steps:
40
411. Stop the ``acrnlog`` service:
42
43 .. code-block:: none
44
45 sudo systemctl disable acrnlog
46
472. Restart ``acrnlog``, running in the background, and specify the new
48 number of log files and their size (in MB). For example:
49
50 .. code-block:: none
51
52 sudo acrnlog -n 8 -s 4 &
53
54You can use the ``loglevel`` command in the hypervisor shell (not the Service
55VM shell) to query or dynamically override the hypervisor log level
56configuration settings made in the ACRN Configurator tool to the
57:option:`hv.DEBUG_OPTIONS.MEM_LOGLEVEL`,
58:option:`hv.DEBUG_OPTIONS.CONSOLE_LOGLEVEL`, and
59:option:`hv.DEBUG_OPTIONS.NPK_LOGLEVEL` options. If the
60system is rebooted, these log level settings will return to the
61values set by the ACRN Configurator.
62
63The ``mem_loglevel`` parameter controls the log to be saved using
64``acrnlog``, while the ``console_loglevel`` parameter controls the log
65output to the console. For example, in the hypervisor shell you
66can use these commands:
67
68.. code-block:: none
69
70 ACRN:\>loglevel
71 console_loglevel: 3, mem_loglevel: 5, npk_loglevel: 5
72 ACRN:\>loglevel 2 5
73 ACRN:\>loglevel
74 console_loglevel: 2, mem_loglevel: 5, npk_loglevel: 5
75
76
77Permanent Log File Changes
78==========================
79
80You can permanently change the log file settings by
81editing ``/usr/lib/systemd/system/acrnlog.service`` and use the ``-n``
82and ``-s`` options on the ``ExecStart`` cmd, and restart the service.
83For example, ``acrnlog.service`` could have these parameters added:
84
85.. code-block:: none
86
87 ExecStart=/usr/bin/acrnlog -n 8 -s 4
88
89and then restart the service with:
90
91.. code-block:: none
92
93 sudo systemctl daemon-reload
94 sudo systemctl restart acrnlog
95
96Build and Install
97*****************
98
99Source code for the ``acrnlog`` tool is in the ``misc/debug_tools/acrn_log``
100directory. To build and install the tool from source, run these commands:
101
102.. code-block:: none
103
104 make
105 sudo make install
106
107and if you changed the ``acrnlog.service`` file, install it:
108
109.. code-block:: none
110
111 sudo cp acrnlog.service /usr/lib/systemd/system/
112