2018-05-30 06:54:57 +08:00
|
|
|
.. _acrnlog:
|
2018-03-29 16:17:45 +08:00
|
|
|
|
2021-02-13 08:27:24 +08:00
|
|
|
Acrnlog
|
2018-05-30 06:54:57 +08:00
|
|
|
#######
|
2018-03-29 16:17:45 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
Description
|
|
|
|
***********
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2021-10-26 01:38:02 +08:00
|
|
|
``acrnlog`` is a userland tool used to capture an ACRN hypervisor log. It runs
|
|
|
|
as a Service VM service at boot, capturing two kinds of logs:
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2022-03-19 06:24:35 +08:00
|
|
|
- log of the running hypervisor
|
2021-10-26 01:38:02 +08:00
|
|
|
- log of the last running hypervisor if it crashed and the logs remain
|
2018-03-29 16:17:45 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
Log files are saved in ``/tmp/acrnlog/``, so the log files would be lost
|
|
|
|
after a system reset.
|
2018-03-29 16:17:45 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
Usage
|
|
|
|
*****
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
The ``acrnlog`` tool is launched as a service at boot, and limited to
|
|
|
|
supporting four 1MB log files by default. You can change this log file
|
|
|
|
limitation temporarily or permanently.
|
2018-03-29 16:17:45 +08:00
|
|
|
|
2018-06-13 21:47:35 +08:00
|
|
|
Options:
|
|
|
|
|
2018-06-19 22:35:39 +08:00
|
|
|
-h display help
|
|
|
|
-t specify a polling interval (ms). Once buffer is empty, acrnlog stops
|
|
|
|
and starts reading in specified interval.
|
|
|
|
If an incomplete log warning is reported, please try with a smaller
|
|
|
|
interval to get a complete log.
|
|
|
|
-s limit the size of each log file, in KB. 0 means no limitation.
|
|
|
|
-n specify the number of log files to keep, old files would be deleted.
|
2018-03-29 16:17:45 +08:00
|
|
|
|
2021-02-13 08:27:24 +08:00
|
|
|
Temporary Log File Changes
|
2018-05-30 06:54:57 +08:00
|
|
|
==========================
|
2018-03-29 16:17:45 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
You can temporarily change the log file setting by following these
|
|
|
|
steps:
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
1. Stop the ``acrnlog`` service:
|
2018-03-29 16:17:45 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
.. code-block:: none
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2021-11-03 03:39:23 +08:00
|
|
|
sudo systemctl disable acrnlog
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
2. Restart ``acrnlog``, running in the background, and specify the new
|
|
|
|
number of log files and their size (in MB). For example:
|
2018-03-29 16:17:45 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
.. code-block:: none
|
2018-03-29 16:17:45 +08:00
|
|
|
|
2021-11-03 03:39:23 +08:00
|
|
|
sudo acrnlog -n 8 -s 4 &
|
2018-03-29 16:17:45 +08:00
|
|
|
|
2021-10-26 01:38:02 +08:00
|
|
|
You can use the ``loglevel`` command in the hypervisor shell (not the Service
|
2021-10-26 06:47:38 +08:00
|
|
|
VM shell) to query or dynamically override the hypervisor log level
|
|
|
|
configuration settings made in the ACRN Configurator tool to the
|
|
|
|
:option:`hv.DEBUG_OPTIONS.MEM_LOGLEVEL`,
|
|
|
|
:option:`hv.DEBUG_OPTIONS.CONSOLE_LOGLEVEL`, and
|
|
|
|
:option:`hv.DEBUG_OPTIONS.NPK_LOGLEVEL` options. If the
|
|
|
|
system is rebooted, these log level settings will return to the
|
|
|
|
values set by the ACRN Configurator.
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-31 21:31:56 +08:00
|
|
|
The ``mem_loglevel`` parameter controls the log to be saved using
|
|
|
|
``acrnlog``, while the ``console_loglevel`` parameter controls the log
|
|
|
|
output to the console. For example, in the hypervisor shell you
|
|
|
|
can use these commands:
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-30 06:54:57 +08:00
|
|
|
.. code-block:: none
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2019-05-08 10:41:44 +08:00
|
|
|
ACRN:\>loglevel
|
|
|
|
console_loglevel: 3, mem_loglevel: 5, npk_loglevel: 5
|
|
|
|
ACRN:\>loglevel 2 5
|
|
|
|
ACRN:\>loglevel
|
|
|
|
console_loglevel: 2, mem_loglevel: 5, npk_loglevel: 5
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2018-05-31 21:31:56 +08:00
|
|
|
|
2021-02-13 08:27:24 +08:00
|
|
|
Permanent Log File Changes
|
2018-05-30 06:54:57 +08:00
|
|
|
==========================
|
2018-05-25 04:21:16 +08:00
|
|
|
|
2021-10-26 01:38:02 +08:00
|
|
|
You can permanently change the log file settings by
|
2018-05-30 06:54:57 +08:00
|
|
|
editing ``/usr/lib/systemd/system/acrnlog.service`` and use the ``-n``
|
|
|
|
and ``-s`` options on the ``ExecStart`` cmd, and restart the service.
|
|
|
|
For example, ``acrnlog.service`` could have these parameters added:
|
|
|
|
|
|
|
|
.. code-block:: none
|
|
|
|
|
|
|
|
ExecStart=/usr/bin/acrnlog -n 8 -s 4
|
|
|
|
|
|
|
|
and then restart the service with:
|
|
|
|
|
|
|
|
.. code-block:: none
|
|
|
|
|
2021-11-03 03:39:23 +08:00
|
|
|
sudo systemctl daemon-reload
|
|
|
|
sudo systemctl restart acrnlog
|
2018-05-30 06:54:57 +08:00
|
|
|
|
|
|
|
Build and Install
|
|
|
|
*****************
|
|
|
|
|
2021-10-26 01:38:02 +08:00
|
|
|
Source code for the ``acrnlog`` tool is in the ``misc/debug_tools/acrn_log``
|
|
|
|
directory. To build and install the tool from source, run these commands:
|
2018-05-30 06:54:57 +08:00
|
|
|
|
|
|
|
.. code-block:: none
|
|
|
|
|
2021-11-03 03:39:23 +08:00
|
|
|
make
|
|
|
|
sudo make install
|
2018-05-30 06:54:57 +08:00
|
|
|
|
2021-10-26 01:38:02 +08:00
|
|
|
and if you changed the ``acrnlog.service`` file, install it:
|
2018-05-30 06:54:57 +08:00
|
|
|
|
|
|
|
.. code-block:: none
|
|
|
|
|
2021-11-03 03:39:23 +08:00
|
|
|
sudo cp acrnlog.service /usr/lib/systemd/system/
|