How to filter logcat output in ACRA?

北慕城南 提交于 2019-12-12 01:08:18

问题


I am using ACRA library in my application. My debug messages write into logcat with methods from Log class. And just this messages contains 90% important information. Logcat output is included in my report. When I run it on emulator it contains only my messages and output from printStackTrace() method (as I want). But when I run it on real device (SGS4) I get too many unnecessary messages. For example:

D/ProgressBar(10716): setProgressDrawable mProgressDrawable = null, d = android.graphics.drawable.LayerDrawable@4257df18needUpdate = false
D/ProgressBar(10716): setProgressDrawable drawableHeight = 0
D/ProgressBar(10716): setProgress = 0
D/ProgressBar(10716): setProgress = 0, fromUser = false
D/ProgressBar(10716): mProgress = 0mIndeterminate = false, mMin = 0, mMax = 100
D/ProgressBar(10716): updateDrawableBounds: bottom = 228
I/endeffect(10716): AbsListView.onMeasure(), getWidth()=750, getHeight()=1689, this=android.widget.ListView{427234a0 VFED.VC. ......ID 0,0-750,1689 #7f070083 app:id/menu_list}
I/endeffect(10716): AbsListView.onMeasure(), getWidth()=750, getHeight()=1689, this=android.widget.ListView{427234a0 VFED.VC. ......ID 0,0-750,1689 #7f070083 app:id/menu_list}
D/AbsListView(10716): unregisterIRListener() is called 
D/AbsListView(10716): unregisterIRListener() is called 
D/AbsListView(10716): unregisterIRListener() is called 
D/AbsListView(10716): unregisterIRListener() is called 
D/AbsListView(10716): unregisterIRListener() is called 
D/AbsListView(10716): Get MotionRecognitionManager
D/AbsListView(10716): Get MotionRecognitionManager
W/Resources(10716): Converting to string: TypedValue{t=0x10/d=0x3c a=-1}
W/Resources(10716): Converting to string: TypedValue{t=0x10/d=0x3c a=-1}
I/CustomFrequencyManager(10716): newFrequencyRequest  - mFrequency = 800000, mTimeoutMs = -1, mPkgName = LIST_SCROLL_BOOSTER@5
I/CustomFrequencyManager(10716): Boost Request from package = LIST_SCROLL_BOOSTER@5 frequency : 800000type = 6
I/CustomFrequencyManager(10716): !! pkgName = LIST_SCROLL_BOOSTER@5
I/CustomFrequencyManager(10716): Request from package name pkgName = LIST_SCROLL_BOOSTER@5
I/CustomFrequencyManager(10716): mToken is Null....Creating New Binder!
I/CustomFrequencyManager(10716): CPUDVFSControlRequest : doFrequencyRequest::  = 800000 Timeout : -1
E/SpannableStringBuilder(10716): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
E/SpannableStringBuilder(10716): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
E/SpannableStringBuilder(10716): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
E/SpannableStringBuilder(10716): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
E/SpannableStringBuilder(10716): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
E/SpannableStringBuilder(10716): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
E/SpannableStringBuilder(10716): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
E/SpannableStringBuilder(10716): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
E/SpannableStringBuilder(10716): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
E/SpannableStringBuilder(10716): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
E/SpannableStringBuilder(10716): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
E/SpannableStringBuilder(10716): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
E/SpannableStringBuilder(10716): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
E/SpannableStringBuilder(10716): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

Logcat is clogged with this messages about 90%. But I not needed in this messages. How filter it correctly?

Now I am using this:

logcatArguments = { "-t", "300", "ru.bartwell.myapp:V" }

Also I know that I can write my own log with my messages only and then include it to ACRA report. But is this correct to make writing into file so often? I'm afraid that is adversely affect on SD-card.


回答1:


you can refer this link:

https://github.com/ACRA/acra/wiki/AdvancedUsage

For example, if you prefer using:

adb logcat -t 100 -v long ActivityManager:I MyApp:D :S then add this to you {@ReportsCrashes} config: logcatArguments = { "-t", "100", "-v", "long", "ActivityManager:I", "MyApp:D", ":S" }

try to provide more specific into logcatArguments command.

writing into the sdcard so often is not the correct option.




回答2:


I get needed with it:

logcatArguments = { "-t", "300", "MyAppTag:V", "System.err:V", "AndroidRuntime:V", "*:S" }


来源:https://stackoverflow.com/questions/20125557/how-to-filter-logcat-output-in-acra

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!