blob: cdb6da541180f06ad0ba0925d65e5adebadfa1a4 [file] [log] [blame] [view]
Daniel Eratace8d3622017-12-20 23:27:241# Chrome Logging on Chrome OS
2
3## Locations
4
5Messages written via the logging macros in [base/logging.h] end up in different
6locations depending on Chrome's state:
7
François Degros0686ae992022-08-24 04:50:308`/var/log/ui/ui.LATEST`
9: contains data written to stdout and stderr by Chrome (and technically also
10 [session_manager]). This generally comprises messages that are written very
11 early in Chrome's startup process, before logging has been initialized.
Daniel Eratace8d3622017-12-20 23:27:2412
François Degros0686ae992022-08-24 04:50:3013`/var/log/chrome/chrome`
14: contains messages that are written before a user has logged in. It also
15 contains messages written after login on test images, where Chrome runs with
16 `--disable-logging-redirect`.
17
18`/home/chronos/user/log/chrome`
19: contains messages that are written while a user is logged in on non-test
20 images. Note that this path is within the user's encrypted home directory
21 and is only accessible while the user is logged in.
22
23`/var/log/audit/audit.log`:
24: contains SECCOMP violation messages.
25
26`/var/log/messages`
27: contains messages written by services such as `session_manager`,
28 `cryptohomed` and `cros-disks` that may be useful in determining when or why
29 Chrome started or stopped.
30
31Some of the above files are actually symlinks. Older log files can be found
Daniel Eratace8d3622017-12-20 23:27:2432alongside them in the same directories.
33
François Degros0686ae992022-08-24 04:50:3034## How to increase Chrome's log level to `INFO` on a test device
Daniel Eratace8d3622017-12-20 23:27:2435
François Degros0686ae992022-08-24 04:50:3036By default, only `WARNING`, `ERROR` and `FATAL` messages are written to disk,
37whereas `INFO` and `VERBOSE` messages are discarded.
Daniel Eratace8d3622017-12-20 23:27:2438
François Degros0686ae992022-08-24 04:50:3039To log `INFO` messages, pass `--log-level=0` to Chrome. See the
Daniel Eratace8d3622017-12-20 23:27:2440[Passing Chrome flags from session_manager] document for more details, and
François Degros0686ae992022-08-24 04:50:3041specifically the `/etc/chrome_dev.conf` configuration file that can be used to
42change flags on test devices.
43
44Remount the root filesystem in read-write mode (to be able to modify
45`chrome_dev.conf`):
46
47```sh
48(dut)$ sudo mount -o remount,rw /
49```
50
51Add `--log-level=0` to `chrome_dev.conf`:
52
53```sh
54(dut)$ echo "--log-level=0" | sudo tee -a /etc/chrome_dev.conf > /dev/null
55```
56
57Restart Chrome:
58
59```sh
60(dut)$ sudo restart ui
61```
62
63Follow Chrome's logs:
64
65```sh
66(dut)$ tail -F /var/log/chrome/chrome
67```
Daniel Eratace8d3622017-12-20 23:27:2468
Ian Barkley-Yeung5e0d3702019-01-04 19:10:3969## Verbose Logging
70
François Degros0686ae992022-08-24 04:50:3071When actively debugging issues, Chrome's `--vmodule` flag can be used to log
72verbose messages for particular modules.
73
74For example, to log `VERBOSE1` messages produced by `VLOG(1)` in
75`volume_manager.cc` or `volume_manager.h`:
76
77```sh
78(dut)$ echo "--vmodule=volume_manager=1" | sudo tee -a /etc/chrome_dev.conf > /dev/null
79```
80
81Restart Chrome:
82
83```sh
84(dut)$ sudo restart ui
85```
86
87Follow `volume_manager`'s logs:
88
89```sh
90(dut)$ tail -F /var/log/chrome/chrome | grep volume_manager
91```
Ian Barkley-Yeung5e0d3702019-01-04 19:10:3992
Daniel Eratace8d3622017-12-20 23:27:2493[base/logging.h]: ../base/logging.h
John Palmer046f9872021-05-24 01:24:5694[session_manager]: https://chromium.googlesource.com/chromiumos/platform2/+/main/login_manager/
95[Passing Chrome flags from session_manager]: https://chromium.googlesource.com/chromiumos/platform2/+/main/login_manager/docs/flags.md