你的位置:首页 > 软件开发 > 操作系统 > Android Log Tag含义

Android Log Tag含义

发布时间:2016-11-11 23:00:40
在分析Android问题的时候重要的手段之一就是分析log,在events.log中有很多系统log,其中有些log的含义并不是很了解,下面就是从安卓源码中得到的系统log的tag。  关于Tag的说明如下:以 “30005 am_create_activity (User|1| ...

  在分析Android问题的时候重要的手段之一就是分析log,在events.log中有很多系统log,其中有些log的含义并不是很了解,下面就是从安卓源码中得到的系统log的tag。

  关于Tag的说明如下:以 “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)” 为例,

  其中:

  • 30005 :相当于是am_create_activity这个tag的索引或者标识。不会出现在events.txt中。
  • am_create_activity:TAG名字
  • 后面用()括起来的相当于是这个log的一些信息,以(User|1|5)为例,User表示信息名字,User表示UID,1表示在打印出的log中该信息的数据类型,5表示该数据的单位。

  数据类型有:

  • 1:int
  • 2:long
  • 3:string
  • 4:list
  • 5:float

  数据的单位有:

  • 1:Number of objects
  • 2:Number of bytes
  • 3:Number of milliseconds
  • 4:Number of allocations
  • 5:Id
  • 6:Percent

  所以(User|1|5)表示的意思是:这项信息表示的是User,在Linux即相当于UID,信息的数据类型为1,即int,数据的单位为5,即Id。其他的类似。

  一个实际的log如下:

10-31 17:53:38.288 1232 2211 I am_create_activity: [0,208381599,127,cn.company.photoeditor/com.android.gallery3d.filtershow.FilterShowActivity,android.intent.action.EDIT,image/*,content://media/external/images/media/4427,1],表示的含义即为:

  • 这是一个表示activity创建的log
  • 程序的UID为0
  • 要创建的该activity的TOKEN为208381599
  • 该动作所处的Task ID为127
  • 所要创建的activity组件名为 cn.company.photoeditor/com.android.gallery3d.filtershow.FilterShowActivity
  • 创建该activity消息中的action为android.intent.action.EDIT,MIME TYPE为image/*,URI为content://media/external/images/media/4427,附带的flag为1

下面是源码的中tag定义文件:

service/core/java/com/android/server/am/EventLogTags.logtags:

# See system/core/logcat/event.logtags for a description of the format of this file.option java_package com.android.server.am2719 configuration_changed (config mask|1|5)2721 cpu (total|1|6),(user|1|6),(system|1|6),(iowait|1|6),(irq|1|6),(softirq|1|6)# ActivityManagerService.systemReady() starts:3040 boot_progress_ams_ready (time|2|3)# ActivityManagerService calls enableScreenAfterBoot():3050 boot_progress_enable_screen (time|2|3)# Do not change these names without updating the checkin_events setting in# google3/googledata/wireless/android/provisioning/gservices.config !!## 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 Responding30008 am_anr (User|1|5),(pid|1|5),(Package Name|3),(Flags|1|5),(reason|3)# Activity launch time30009 am_activity_launch_time (User|1|5),(Token|1|5),(Component Name|3),(time|2|3)# Application process bound to work30010 am_proc_bound (User|1|5),(PID|1|5),(Process Name|3)# Application process died30011 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 activity30013 am_pause_activity (User|1|5),(Token|1|5),(Component Name|3)# Application process has been started30014 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 bad30015 am_proc_bad (User|1|5),(UID|1|5),(Process Name|3)# An application process that was bad is now marked as good30016 am_proc_good (User|1|5),(UID|1|5),(Process Name|3)# Reporting to applications that memory is low30017 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 created30030 am_create_service (User|1|5),(Service Record|1|5),(Name|3),(UID|1|5),(PID|1|5)# A service is being destroyed30031 am_destroy_service (User|1|5),(Service Record|1|5),(PID|1|5)# A process has crashed too many times, it is being cleared30032 am_process_crashed_too_much (User|1|5),(Name|3),(PID|1|5)# An unknown process is trying to attach to the activity manager30033 am_drop_process (PID|1|5)# A service has crashed too many times, it is being stopped30034 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 away30035 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 lost30036 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 start30037 am_process_start_timeout (User|1|5),(PID|1|5),(UID|1|5),(Process Name|3)# Unhandled exception30039 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() called30040 am_wtf (User|1|5),(PID|1|5),(Process Name|3),(Flags|1|5),(Tag|3),(Message|3)# User switched30041 am_switch_user (id|1|5)# Activity fully drawn time30042 am_activity_fully_drawn_time (User|1|5),(Token|1|5),(Component Name|3),(time|2|3)# Activity focused30043 am_focused_activity (User|1|5),(Component Name|3),(Reason|3)# Stack focus30044 am_focused_stack (User|1|5),(Focused Stack Id|1|5),(Last Focused Stack Id|1|5),(Reason|3)# Running pre boot receiver30045 am_pre_boot (User|1|5),(Package|3)# Report collection of global memory state30046 am_meminfo (Cached|2|2),(Free|2|2),(Zram|2|2),(Kernel|2|2),(Native|2|2)# Report collection of memory used by a process30047 am_pss (Pid|1|5),(UID|1|5),(Process Name|3),(Pss|2|2),(Uss|2|2),(SwapPss|2|2)# Attempting to stop an activity30048 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)

 

海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com

原标题:Android Log Tag含义

关键词:Android

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录