Android event log 说明

xiaoxiao2021-02-28  110

目录

1. Android 系统中对于 event log 的定义文件 2. event 的类别 3. 手机中查看 event log 事件信息

1. Android 系统中对于 event log 的定义文件

Android event log 定义文件位于:system/core/logcat/event.logtags 在 tag 名称之后,通常会有一个 tag 的描述,格式如下:

(<name>|data type[|data unit]) The data type is a number from the following values: 1: int 2: long 3: string 4: list 5: float The data unit is a number taken from the following list: 1: Number of objects 2: Number of bytes 3: Number of milliseconds 4: Number of allocations 5: Id 6: Percent Default value for data of type int/long is 2 (bytes).

多个值用逗号分割

### 2. event 的类别 通过搜索 event.logtags 可以找到[以下文件](http://androidxref.com/7.1.1_r6/search?q=event.logtags&defs=&refs=&path=&hist=&project=frameworks): /frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/ H A D EventLogTags.logtags 1 # See system/core/logcat/event.logtags for a description of the format of this file. /frameworks/base/core/java/android/app/admin/ H A D SecurityLogTags.logtags 1 # See system/core/logcat/event.logtags for a description of the format of this file. /frameworks/base/core/java/android/webkit/ H A D EventLogTags.logtags 1 # See system/core/logcat/event.logtags for a description of the format of this file. /frameworks/base/core/java/com/android/internal/logging/ H A D EventLogTags.logtags 1 # See system/core/logcat/event.logtags for a description of the format of this file. /frameworks/base/core/java/android/content/ H A D EventLogTags.logtags 1 # See system/core/logcat/event.logtags for a description of the format of this file. /frameworks/base/core/java/android/speech/tts/ H A D EventLogTags.logtags 1 # See system/core/logcat/event.logtags for a description of the format of this file. /frameworks/native/services/surfaceflinger/EventLog/ H A D EventLogTags.logtags 34 # See system/core/logcat/event.logtags for the master copy of the tags. /frameworks/opt/telephony/src/java/com/android/internal/telephony/ H A D EventLogTags.logtags 1 # See system/core/logcat/event.logtags for a description of the format of this file. /frameworks/ex/common/java/com/android/common/ H A D GoogleLogTags.logtags 22 # See system/core/logcat/event.logtags for a description of the file format. /frameworks/base/packages/SystemUI/src/com/android/systemui/ H A D EventLogTags.logtags 1 # See system/core/logcat/event.logtags for a description of the format of this file. /frameworks/base/services/core/java/com/android/server/am/ H A D EventLogTags.logtags 1 # See system/core/logcat/event.logtags for a description of the format of this file. /frameworks/base/services/core/java/com/android/server/ H A D EventLogTags.logtags 1 # See system/core/logcat/event.logtags for a description of the format of this file.

以常见的 ActivityManager 的 event log 来进行解读:

# An activity is being finished: 30001 am_finish_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3),(Reason|3) # A task is being brought to the front of the screen: 30002 am_task_to_front (User|1|5),(Task|1|5) # An existing activity is being given a new intent: 30003 am_new_intent (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3),(Action|3),(MIME Type|3),(URI|3),(Flags|1|5) # A new task is being created: 30004 am_create_task (User|1|5),(Task ID|1|5) # A new activity is being created in an existing task: 30005 am_create_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3),(Action|3),(MIME Type|3),(URI|3),(Flags|1|5) # An activity has been resumed into the foreground but was not already running: 30006 am_restart_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3) # An activity has been resumed and is now in the foreground: 30007 am_resume_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3) # Application Not Responding 30008 am_anr (User|1|5),(pid|1|5),(Package Name|3),(Flags|1|5),(reason|3) # Activity launch time 30009 am_activity_launch_time (User|1|5),(Token|1|5),(Component Name|3),(time|2|3) # Application process bound to work 30010 am_proc_bound (User|1|5),(PID|1|5),(Process Name|3) # Application process died 30011 am_proc_died (User|1|5),(PID|1|5),(Process Name|3) # The Activity Manager failed to pause the given activity. 30012 am_failed_to_pause (User|1|5),(Token|1|5),(Wanting to pause|3),(Currently pausing|3) # Attempting to pause the current activity 30013 am_pause_activity (User|1|5),(Token|1|5),(Component Name|3) # Application process has been started 30014 am_proc_start (User|1|5),(PID|1|5),(UID|1|5),(Process Name|3),(Type|3),(Component|3) # An application process has been marked as bad 30015 am_proc_bad (User|1|5),(UID|1|5),(Process Name|3) # An application process that was bad is now marked as good 30016 am_proc_good (User|1|5),(UID|1|5),(Process Name|3) # Reporting to applications that memory is low 30017 am_low_memory (Num Processes|1|1) # An activity is being destroyed: 30018 am_destroy_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3),(Reason|3) # An activity has been relaunched, resumed, and is now in the foreground: 30019 am_relaunch_resume_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3) # An activity has been relaunched: 30020 am_relaunch_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3) # The activity's onPause has been called. 30021 am_on_paused_called (User|1|5),(Component Name|3),(Reason|3) # The activity's onResume has been called. 30022 am_on_resume_called (User|1|5),(Component Name|3),(Reason|3) # Kill a process to reclaim memory. 30023 am_kill (User|1|5),(PID|1|5),(Process Name|3),(OomAdj|1|5),(Reason|3) # Discard an undelivered serialized broadcast (timeout/ANR/crash) 30024 am_broadcast_discard_filter (User|1|5),(Broadcast|1|5),(Action|3),(Receiver Number|1|1),(BroadcastFilter|1|5) 30025 am_broadcast_discard_app (User|1|5),(Broadcast|1|5),(Action|3),(Receiver Number|1|1),(App|3) # A service is being created 30030 am_create_service (User|1|5),(Service Record|1|5),(Name|3),(UID|1|5),(PID|1|5) # A service is being destroyed 30031 am_destroy_service (User|1|5),(Service Record|1|5),(PID|1|5) # A process has crashed too many times, it is being cleared 30032 am_process_crashed_too_much (User|1|5),(Name|3),(PID|1|5) # An unknown process is trying to attach to the activity manager 30033 am_drop_process (PID|1|5) # A service has crashed too many times, it is being stopped 30034 am_service_crashed_too_much (User|1|5),(Crash Count|1|1),(Component Name|3),(PID|1|5) # A service is going to be restarted after its process went away 30035 am_schedule_service_restart (User|1|5),(Component Name|3),(Time|2|3) # A client was waiting for a content provider, but its process was lost 30036 am_provider_lost_process (User|1|5),(Package Name|3),(UID|1|5),(Name|3) # The activity manager gave up on a new process taking too long to start 30037 am_process_start_timeout (User|1|5),(PID|1|5),(UID|1|5),(Process Name|3) # Unhandled exception 30039 am_crash (User|1|5),(PID|1|5),(Process Name|3),(Flags|1|5),(Exception|3),(Message|3),(File|3),(Line|1|5) # Log.wtf() called 30040 am_wtf (User|1|5),(PID|1|5),(Process Name|3),(Flags|1|5),(Tag|3),(Message|3) # User switched 30041 am_switch_user (id|1|5) # Activity fully drawn time 30042 am_activity_fully_drawn_time (User|1|5),(Token|1|5),(Component Name|3),(time|2|3) # Activity focused 30043 am_focused_activity (User|1|5),(Component Name|3),(Reason|3) # Stack focus 30044 am_focused_stack (User|1|5),(Focused Stack Id|1|5),(Last Focused Stack Id|1|5),(Reason|3) # Running pre boot receiver 30045 am_pre_boot (User|1|5),(Package|3) # Report collection of global memory state 30046 am_meminfo (Cached|2|2),(Free|2|2),(Zram|2|2),(Kernel|2|2),(Native|2|2) # Report collection of memory used by a process 30047 am_pss (Pid|1|5),(UID|1|5),(Process Name|3),(Pss|2|2),(Uss|2|2),(SwapPss|2|2) # Attempting to stop an activity 30048 am_stop_activity (User|1|5),(Token|1|5),(Component Name|3) # The activity's onStop has been called. 30049 am_on_stop_called (User|1|5),(Component Name|3),(Reason|3) # Report changing memory conditions (Values are ProcessStats.ADJ_MEM_FACTOR* constants) 30050 am_mem_factor (Current|1|5),(Previous|1|5)

以 30001 am_finish_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3),(Reason|3) 为例说明,这一句对应 log I/am_finish_activity( 2878): [0,149956396,1985,com.android.settings/.Settings,app-request] com.android.settings包中的Settings结束,其中用户 id 为 0(系统),Token 为 149956396,任务 id 1985,结束原因 app-request。

### 3. 手机中查看 event log 事件信息 ``` adb shell cat /system/etc/event-log-tags ```
转载请注明原文地址: https://www.6miu.com/read-19084.html

最新回复(0)