问题描述
我在开发Android一个简单的程序。
我测试了它的真实设备三星年轻的Android 2.3。
我的程序产生用于调试的目的一些日志输出。
每一件事情是确定的,但我的设备开始产生大量的消息在Eclipse LogCat中的窗口,甚至当我PROG未运行。装置产生这样的消息:
I was developing a simple program for android.
I tested it on a real device samsung young android 2.3.
My program produce some log output for debugging purpose.
Every thing was ok, but my device began to produce a lot of messages in Eclipse LogCat window, even when my prog was not running. Device produces messages like this:
02-08 09:14:51.960: D/CallManager(1560): handleMessage (EVENT_SERVICE_STATE_CHANGED)
02-08 09:14:54.078: E/StatusBarPolicy(1548): ecio: 22
02-08 09:14:54.078: E/StatusBarPolicy(1548): iconLevel: 4
02-08 09:14:56.640: E/StatusBarPolicy(1548): ecio: 23
02-08 09:14:56.640: E/StatusBarPolicy(1548): iconLevel: 4
02-08 09:14:59.203: E/StatusBarPolicy(1548): ecio: 24
02-08 09:14:59.203: E/StatusBarPolicy(1548): iconLevel: 4
02-08 09:16:00.007: E/ClockWidget(3324): getOrientation portrait
02-08 09:16:00.007: E/ClockWidget(3324): drawDayText
02-08 09:16:00.007: E/ClockWidget(3324): width= 50
02-08 09:16:00.007: E/ClockWidget(3324): widthText= 63.0
02-08 09:16:00.015: E/ClockWidget(3324): RIGHT
02-08 09:16:00.640: E/StatusBarPolicy(1548): ecio: 26
02-08 09:16:00.640: E/StatusBarPolicy(1548): iconLevel: 4
02-08 09:18:26.617: D/BatteryService(1495): CHARGER :: mBatteryStatus = 4
02-08 09:18:26.617: D/BatteryService(1495): updateBattery level:99 scale:100 status:4 health:2 present:false voltage: 4 temperature: 340 technology: Li-ion AC powered:false USB powered:true icon:17302184
02-08 09:18:26.632: D/WifiService(1495): [mPersistState] : On
02-08 09:18:26.632: I/StatusBarPolicy(1548): BAT. S:4 H:2
02-08 09:18:26.656: D/Vold(1306): VolumeManager::handleSwitchEvent -> Changed USB status SWITCH_NAME(usb_mass_storage),SWITCH_STATE(offline)
02-08 09:18:26.656: W/Vold(1306): Ignoring unknown switch 'usb_mass_storage'
02-08 09:18:26.656: D/Vold(1306): VolumeManager::handleSwitchEvent -> Changed USB status SWITCH_NAME(usb_connected),SWITCH_STATE(0)
02-08 09:18:26.656: W/Vold(1306): Ignoring unknown switch 'usb_connected'
02-08 09:18:27.078: I/PowerManagerService(1495): Light Animator Finished curIntValue=143
02-08 09:18:27.242: D/AndroidRuntime(13895): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
02-08 09:18:27.242: D/AndroidRuntime(13895): CheckJNI is OFF
02-08 09:18:27.242: I/AndroidRuntime(13895): JNI options: '-Xjniopts:warnonly'
02-08 09:18:27.242: E/AndroidRuntime(13895): feature code ==> cannot open file
02-08 09:18:27.421: D/LibQmg_native(13895): register_android_app_LibQmg
02-08 09:18:27.476: D/AndroidRuntime(13895): Calling main entry com.android.commands.am.Am
等。装置产生它不断,我不能阻止它。
当我跑我PROGRAMM就不可能找到有用的日志信息。
And so on. Device generates it constantly, i can't stop it.When i run my programm it becomes impossible to find usefull log messages.
我怎么能阻止我的设备生产这样的消息?
How can i stop my device producing such messages?
推荐答案
只要创建一个过滤器为自己的应用程序。
Just create a filter for your own application.
的步骤:
- 转到在DDMS透视图。
- 在logcat的选项卡中,单击绿色+西港岛线其中调出以下弹出的迹象
- 在按应用程序名称:部分,把你的根命名空间。例如: com.abc.testapp 的
- Go in the DDMS perspective.
- In the logcat tab, click on the green + sign which wil bring up the following pop-up
- In the by Application Name: section, put in your root namespace. For example: com.abc.testapp
的替代方法:的
如果你还没有尝试过早期的选项,同时仍然在所有消息的logcat中的部分中,找到堆栈跟踪这对您的应用程序 - >右键 - > 过滤器类似的消息。通过应用程序名称清除出比其他一切,你会得到同样的结果。
Alternative method:If you haven't tried the earlier option, while still in the All Message section of logcat, find the stacktrace that is for your application -> Right Click -> Filter similar message. Clear out everything other than the by Application Name and you will get the same result.
现在你会在你的logcat的标签两个条目。一个用于所有的消息,一个是你的应用程序。
Now you will have two entries in your logcat tab. One for all message and one for your application.
这篇关于真实的设备产生太多的日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!