Real device produce too many log

2020-04-16 01:48发布

问题:


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

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?

回答1:

Just create a filter for your own application.

STEPS:

  1. Go in the DDMS perspective.
  2. In the logcat tab, click on the green + sign which wil bring up the following pop-up
  3. In the by Application Name: section, put in your root namespace. For example: com.abc.testapp

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.

Now you will have two entries in your logcat tab. One for all message and one for your application.



回答2:

In eclipse, if you have the DDMS perspective open, you can select the application from the filters. If there is none create, you can create your own filters.

Check this out for more information.