2023-11-24 10:17:08 +00:00
|
|
|
# Debugging
|
2019-01-29 15:18:42 +00:00
|
|
|
|
2020-09-22 15:46:35 +00:00
|
|
|
For other debugging resources, see also: Remote project [wiki]
|
2019-11-15 13:42:22 +00:00
|
|
|
|
2023-11-24 10:17:08 +00:00
|
|
|
## Increasing the logging verbosity
|
2019-01-29 15:18:42 +00:00
|
|
|
|
|
|
|
To increase the internal logging verbosity you can use the
|
|
|
|
`remote.log.level` [preference].
|
|
|
|
|
2019-10-23 15:49:19 +00:00
|
|
|
If you use mach to start Firefox:
|
2019-01-29 15:18:42 +00:00
|
|
|
|
2023-11-24 10:17:08 +00:00
|
|
|
```shell
|
|
|
|
% ./mach run --setpref "remote.log.level=Trace" --remote-debugging-port
|
|
|
|
```
|
2019-01-29 15:18:42 +00:00
|
|
|
|
2020-09-22 15:46:35 +00:00
|
|
|
By default, long log lines are truncated. To print long lines in full, you
|
|
|
|
can set `remote.log.truncate` to false.
|
2019-11-15 13:42:22 +00:00
|
|
|
|
2023-11-24 10:17:08 +00:00
|
|
|
## Enabling logging of emitted events
|
2019-10-23 15:49:19 +00:00
|
|
|
|
|
|
|
To dump events produced by EventEmitter,
|
2021-05-25 09:13:29 +00:00
|
|
|
including CDP events produced by the Remote Agent,
|
2019-10-23 15:49:19 +00:00
|
|
|
you can use the `toolkit.dump.emit` [preference]:
|
|
|
|
|
2023-11-24 10:17:08 +00:00
|
|
|
```shell
|
|
|
|
% ./mach run --setpref "toolkit.dump.emit=true" --remote-debugging-port
|
|
|
|
```
|
2019-10-23 15:49:19 +00:00
|
|
|
|
2023-11-24 10:17:08 +00:00
|
|
|
## Logging observer notifications
|
2019-11-15 13:42:22 +00:00
|
|
|
|
2022-01-17 10:49:42 +00:00
|
|
|
Observer notifications are used extensively throughout the
|
2019-11-15 13:42:22 +00:00
|
|
|
code and it can sometimes be useful to log these to see what is
|
|
|
|
available and when they are fired.
|
|
|
|
|
|
|
|
The `MOZ_LOG` environment variable controls the C++ logs and takes
|
|
|
|
the name of the subsystem along with a verbosity setting. See
|
|
|
|
[prlog.h] for more details.
|
|
|
|
|
2023-11-24 10:17:08 +00:00
|
|
|
```shell
|
|
|
|
MOZ_LOG=ObserverService:5
|
|
|
|
```
|
2019-11-15 13:42:22 +00:00
|
|
|
|
|
|
|
You can optionally redirect logs away from stdout to a file:
|
|
|
|
|
2023-11-24 10:17:08 +00:00
|
|
|
```shell
|
|
|
|
MOZ_LOG_FILE=service.log
|
|
|
|
```
|
2019-11-15 13:42:22 +00:00
|
|
|
|
|
|
|
This enables `LogLevel::Debug` level information and places all
|
|
|
|
output in the file service.log in your current working directory.
|
|
|
|
|
2022-01-11 10:48:20 +00:00
|
|
|
[preference]: Prefs.md
|
2019-11-15 13:42:22 +00:00
|
|
|
[prlog.h]: https://searchfox.org/mozilla-central/source/nsprpub/pr/include/prlog.h
|
2020-09-22 15:46:35 +00:00
|
|
|
[wiki]: https://wiki.mozilla.org/Remote/Developer_Resources
|