Working with Logs
Log files are especially helpful to developers, but not always very easy to access.
nimbus-cli
uses adb logcat
on Android, and on iOS it uses the Unix commands find
and tail
.
These logs are useful when examining the internal state of the app, or attaching to bug reports.
For iOS the logs that are displayed and captured are the app's logs. For Android, the logs are for the whole device. For Android devices also used for personal usage, you should probably not upload such logs anywhere.
capture-logs
Capturing a device log
nimbus-cli --app firefox_ios --channel developer \
capture-logs logs.txt
tail-logs
You can set up a different terminal window to watch the logs as they are generated.
nimbus-cli --app firefox_ios --channel developer tail-logs
If you know of any keywords you may be interested in, you can filter piping the output to the grep
command.
For example, the following outputs any log entry containing the word send-tab
.
nimbus-cli --app firefox_ios --channel developer tail-logs | grep -i send-tab
On iOS, because the
reset-app
command deletes the app contaner, thetail-logs
command is only available after the first run after a reset, and stops after a reset.
log-state
This command is an analog for the experiments menu in the secret settings of Fenix and Firefox for iOS.
It relaunches the app, then asks the SDK to dump the state of the Nimbus SDK to the logs. For example:
For example, this is a section of logs captured on an Android device shortly after log-state
, and an enrollment into the viewpoint-rolling-week-2-expansion-android
experiment:
06-05 12:12:47.177 12737 12737 D nimbus::nimbus_client: nimbus_18d_NimbusClient_dump_state_to_log
06-05 12:12:47.177 12737 12737 I nimbus::nimbus_client: Slug | Features | Branch
06-05 12:12:47.177 12737 12737 I nimbus::nimbus_client: viewpoint-rolling-week-2-expansion-android | messaging | treatment
06-05 12:12:47.177 12737 12841 D nimbus::nimbus_client: nimbus_18d_NimbusClient_set_fetch_enabled
It is useful to use in conjunction with other logging commands:
nimbus-cli --app fenix --channel developer log-state
nimbus-cli --app fenix --channel developer tail-log | grep -i nimbus
or
nimbus-cli --app fenix --channel developer log-state
nimbus-cli --app fenix --channel developer capture-logs logs.txt
By default, log-state
is called at the same time as the enroll
command.
For iOS, it can be a bit tricky to see the state of logs at the beginning of a just-installed but not yet opened app.
You can do the same as enroll
then tail-logs
with by adding -- --console-pty {}
to the end of the enroll command.
$ nimbus-cli --app firefox_ios --channel developer \
enroll \
ios-search-bar-placement-v2-treatment-a-rollout --branch treatment-a \
-- --console-pty {}
2023-06-15 17:06:29.611 💙 INFO [sync] Profile - [RUST][nimbus::nimbus_client] [Nimbus] Days since update: 0 2023-06-15 17:06:29.644 💙 INFO [sync] Profile - [RUST][nimbus::nimbus_client] Slug | Features | Branch 2023-06-15 17:06:29.645 💙 INFO [sync] Profile - [RUST][nimbus::nimbus_client] ios-search-bar-placement-v2-treatment-a-rollout | search | treatment-a 2023-06-15 17:06:29.645 💙 INFO [experiments] Experiments - Nimbus is ready!