• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Android Log
2
3_This data source is supported only on Android userdebug builds._
4
5The "android.log" data source records log events from the Android log
6daemon (`logd`). These are the same log messages that are available via
7`adb logcat`.
8
9Both textual events and binary-formatted events from the [EventLog] are
10supported.
11
12This allows you to see log events time-synced with the rest of the trace. When recording
13[long traces](/docs/concepts/config#long-traces), it allows you to record event
14logs indefinitely, regardless of the Android log daemon buffer size
15(i.e. log events are periodically fetched and copied into the trace buffer).
16
17The data source can be configured to filter event from specific log buffers and
18keep only the events matching specific tags or priority.
19
20[EventLog]: https://developer.android.com/reference/android/util/EventLog
21
22### UI
23
24At the UI level, log events are showed in two widgets:
25
261. A summary track that allows to quickly glance at the distribution of events
27   and their severity on the timeline.
28
292. A table, time-synced with the viewport, that allows to see events within the
30   selected time range.
31
32![](/docs/images/android_logs.png "Android logs in the UI")
33
34### SQL
35
36```sql
37select l.ts, t.tid, p.pid, p.name as process, l.prio, l.tag, l.msg
38from android_logs as l left join thread as t using(utid) left join process as p using(upid)
39```
40ts | tid | pid | process | prio | tag | msg
41---|-----|-----|---------|------|-----|----
42291474737298264 | 29128 | 29128 | traced_probes | 4 | perfetto | probes_producer.cc:231 Ftrace setup (target_buf=1)
43291474852699265 | 625 | 625 | surfaceflinger | 3 | SurfaceFlinger | Finished setting power mode 1 on display 0
44291474853274109 | 1818 | 1228 | system_server | 3 | SurfaceControl | Excessive delay in setPowerMode()
45291474882474841 | 1292 | 1228 | system_server | 4 | DisplayPowerController | Unblocked screen on after 242 ms
46291474918246615 | 1279 |    1228 | system_server | 4 | am_pss | Pid=28568 UID=10194 Process Name="com.google.android.apps.fitness" Pss=12077056 Uss=10723328 SwapPss=183296 Rss=55021568 StatType=0 ProcState=18 TimeToCollect=51
47
48### TraceConfig
49
50Trace proto:
51[AndroidLogConfig](/docs/reference/trace-packet-proto.autogen#AndroidLogConfig)
52
53Config proto:
54[AndroidPowerConfig](/docs/reference/trace-config-proto.autogen#AndroidPowerConfig)
55
56Sample config:
57
58```protobuf
59data_sources: {
60    config {
61        name: "android.log"
62        android_log_config {
63            min_prio: PRIO_VERBOSE
64            filter_tags: "perfetto"
65            filter_tags: "my_tag_2"
66            log_ids: LID_DEFAULT
67            log_ids: LID_RADIO
68            log_ids: LID_EVENTS
69            log_ids: LID_SYSTEM
70            log_ids: LID_CRASH
71            log_ids: LID_KERNEL
72        }
73    }
74}
75```
76