2013-11-21 79 views
0

我在我的應用程序中使用ACRA庫。我的調試消息使用Log類的方法寫入logcat。而這條消息包含了90%的重要信息。 Logcat輸出包含在我的報告中。當我在模擬器上運行它時,它只包含我的消息和printStackTrace()方法的輸出(如我所願)。但是當我在真實設備(SGS4)上運行它時,我得到了太多不必要的消息。例如:如何篩選ACRA中的logcat輸出?

D/ProgressBar(10716): setProgressDrawable mProgressDrawable = null, d = [email protected] = 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 = [email protected] 
I/CustomFrequencyManager(10716): Boost Request from package = [email protected] frequency : 800000type = 6 
I/CustomFrequencyManager(10716): !! pkgName = [email protected] 
I/CustomFrequencyManager(10716): Request from package name pkgName = [email protected] 
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被這條消息堵塞了大約90%。但是我不需要這個消息。如何正確過濾?

現在我用這:

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

而且我知道我可以寫我自己的日誌,只有我的信息,然後將其包括對ACRA報告。但是,這是正確的,以便經常寫入文件?我擔心這會對SD卡造成負面影響。

回答

1

你可以參考以下鏈接:

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

For example, if you prefer using: 

亞行logcat -t 100 -v長ActivityManager:我MyApp的:d :對英語新 再加入這個{} @ReportsCrashes配置: logcatArguments = { 「-T」, 「100」, 「-v」, 「長」, 「ActivityManager:I」, 「MyApp的:d」, 「:S」}

嘗試提供更具體的進入logcatArguments命令。

往往寫入SD卡不是正確的選項。

1

我需要得到它:

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