Reputation: 2703
I am using ACRA for android app like this
@ReportsCrashes(formKey = "dEpU12345lRZYjFtOUxMVHl4MFpMdnc6MQ", mailTo = "[email protected]",
customReportContent = { ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL, ReportField.CUSTOM_DATA, ReportField.STACK_TRACE, ReportField.LOGCAT },
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text)
it is perfectly sending crash report along with Log cat. It is sending all last 200 lines of logcat with date by default.But I want to customize it to send only last 100 log cat messages of my app with log levels i or d. How to do it.
By following below link
I made changes like this
@ReportsCrashes(formKey = "dEpU12345lRZYjFtOUxMVHl4MFpMdnc6MQ", mailTo = "[email protected]",
customReportContent = { ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL, ReportField.CUSTOM_DATA, ReportField.STACK_TRACE, ReportField.LOGCAT },
logcatArguments = { "-t", "100", "-v", "long","test:I" ,"*:D","*:S"},
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text)
even though I printed some log messages with tag "test" and level "i", and manged them to print before my known crash in my app, I am getting empty logcat. I want log messages of only my app with level i or d with ACRA, how to achieve this. Thanks In Advance.
Upvotes: 3
Views: 2344
Reputation: 4275
The below works for me for D level logging. My proguard strips V and I levels for production deployemnts. I am using the following code to update the log
Log.d("YOUR_TAG_HERE", "Some message here");
and the ACRA configuration is
logcatArguments = { "-t", "200", "-v", "long", "ActivityManager:I", "YOUR_TAG_HERE:D", "*:S" }
and don't forget to update your AndroidManifest.xml file adding the necessary permissions
<uses-permission android:name="android.permission.READ_LOGS" />
I was having troubles with my library project and my READ_LOGS permission was missing. I was getting random results until I added the READ_LOGS permission to the final project (not the library project).
Upvotes: 2