Update ChromeOS logging doc
Give more actionable commands to increase Chrome's log level on ChromeOS. Bug: None Change-Id: I1efc1a01133258e4abec8ce27f2e79e2395d2e11 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3853113 Reviewed-by: Marcello Salomao <msalomao@google.com> Commit-Queue: François Degros <fdegros@chromium.org> Cr-Commit-Position: refs/heads/main@{#1038577}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
d79ed9e1b6
commit
0686ae9941
@ -5,38 +5,90 @@
|
||||
Messages written via the logging macros in [base/logging.h] end up in different
|
||||
locations depending on Chrome's state:
|
||||
|
||||
* `/var/log/ui/ui.LATEST` contains data written to stdout and stderr by Chrome
|
||||
(and technically also [session_manager]). This generally comprises messages
|
||||
that are written very early in Chrome's startup process, before logging has
|
||||
been initialized.
|
||||
* `/var/log/chrome/chrome` contains messages that are written before a user has
|
||||
logged in. It also contains messages written after login on test images, where
|
||||
chrome runs with `--disable-logging-redirect`.
|
||||
* `/home/chronos/user/log/chrome` contains messages that are written while a
|
||||
user is logged in on non-test images. Note that this path is within the user's
|
||||
encrypted home directory and is only accessible while the user is logged in.
|
||||
`/var/log/ui/ui.LATEST`
|
||||
: contains data written to stdout and stderr by Chrome (and technically also
|
||||
[session_manager]). This generally comprises messages that are written very
|
||||
early in Chrome's startup process, before logging has been initialized.
|
||||
|
||||
All of the above files are actually symlinks. Older log files can be found
|
||||
`/var/log/chrome/chrome`
|
||||
: contains messages that are written before a user has logged in. It also
|
||||
contains messages written after login on test images, where Chrome runs with
|
||||
`--disable-logging-redirect`.
|
||||
|
||||
`/home/chronos/user/log/chrome`
|
||||
: contains messages that are written while a user is logged in on non-test
|
||||
images. Note that this path is within the user's encrypted home directory
|
||||
and is only accessible while the user is logged in.
|
||||
|
||||
`/var/log/audit/audit.log`:
|
||||
: contains SECCOMP violation messages.
|
||||
|
||||
`/var/log/messages`
|
||||
: contains messages written by services such as `session_manager`,
|
||||
`cryptohomed` and `cros-disks` that may be useful in determining when or why
|
||||
Chrome started or stopped.
|
||||
|
||||
Some of the above files are actually symlinks. Older log files can be found
|
||||
alongside them in the same directories.
|
||||
|
||||
Also notable is `/var/log/messages`. This file contains general syslog messages,
|
||||
but it also includes messages written by `session_manager` that may be useful in
|
||||
determining when or why Chrome started or stopped.
|
||||
## How to increase Chrome's log level to `INFO` on a test device
|
||||
|
||||
## Severity
|
||||
By default, only `WARNING`, `ERROR` and `FATAL` messages are written to disk,
|
||||
whereas `INFO` and `VERBOSE` messages are discarded.
|
||||
|
||||
By default, only messages logged at severity `WARNING` or higher are written to
|
||||
disk. More concretely, `LOG(INFO)` messages are discarded.
|
||||
|
||||
To enable `LOG(INFO)` message, pass `--log-level=0` to Chrome. See the
|
||||
To log `INFO` messages, pass `--log-level=0` to Chrome. See the
|
||||
[Passing Chrome flags from session_manager] document for more details, and
|
||||
specifically the `/etc/chrome_dev.conf` mechanism that can be used to
|
||||
change flags on development devices.
|
||||
specifically the `/etc/chrome_dev.conf` configuration file that can be used to
|
||||
change flags on test devices.
|
||||
|
||||
Remount the root filesystem in read-write mode (to be able to modify
|
||||
`chrome_dev.conf`):
|
||||
|
||||
```sh
|
||||
(dut)$ sudo mount -o remount,rw /
|
||||
```
|
||||
|
||||
Add `--log-level=0` to `chrome_dev.conf`:
|
||||
|
||||
```sh
|
||||
(dut)$ echo "--log-level=0" | sudo tee -a /etc/chrome_dev.conf > /dev/null
|
||||
```
|
||||
|
||||
Restart Chrome:
|
||||
|
||||
```sh
|
||||
(dut)$ sudo restart ui
|
||||
```
|
||||
|
||||
Follow Chrome's logs:
|
||||
|
||||
```sh
|
||||
(dut)$ tail -F /var/log/chrome/chrome
|
||||
```
|
||||
|
||||
## Verbose Logging
|
||||
|
||||
When actively debugging issues, Chrome's `--vmodule` flag is sometimes used to
|
||||
temporarily log messages at lower severities for particular modules.
|
||||
When actively debugging issues, Chrome's `--vmodule` flag can be used to log
|
||||
verbose messages for particular modules.
|
||||
|
||||
For example, to log `VERBOSE1` messages produced by `VLOG(1)` in
|
||||
`volume_manager.cc` or `volume_manager.h`:
|
||||
|
||||
```sh
|
||||
(dut)$ echo "--vmodule=volume_manager=1" | sudo tee -a /etc/chrome_dev.conf > /dev/null
|
||||
```
|
||||
|
||||
Restart Chrome:
|
||||
|
||||
```sh
|
||||
(dut)$ sudo restart ui
|
||||
```
|
||||
|
||||
Follow `volume_manager`'s logs:
|
||||
|
||||
```sh
|
||||
(dut)$ tail -F /var/log/chrome/chrome | grep volume_manager
|
||||
```
|
||||
|
||||
[base/logging.h]: ../base/logging.h
|
||||
[session_manager]: https://chromium.googlesource.com/chromiumos/platform2/+/main/login_manager/
|
||||
|
Reference in New Issue
Block a user