You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found that when native crashes, the EventProcessor process will not be triggered, so the logcat I captured is the log of the next startup. The code is as follows. How can I capture the log when the crash occurs and save it, and then report it with the next startup.
options.addEventProcessor(new EventProcessor() {
@Override
public SentryEvent process(SentryEvent event, Hint hint) {
try {
String logcatCmd = "logcat -t 200 --pid " + android.os.Process.myPid() + " *:V";
Process process = Runtime.getRuntime().exec(logcatCmd);
InputStream input = process.getInputStream();
FileOutputStream out = context.openFileOutput("sentry_logcat.txt", Context.MODE_APPEND);
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = input.read(buffer)) != -1) {
out.write(buffer, 0, bytesRead);
}
out.close();
input.close();
hint.addAttachment(new Attachment(
context.getFilesDir().getPath() + "/sentry_logcat.txt",
"sentry_logcat.txt",
"text/plain"
));
} catch (Exception e) {
Log.e("Sentry",e.getMessage());
}
return event;
}
})
Solution Brainstorm
No response
The text was updated successfully, but these errors were encountered:
Problem Statement
I found that when native crashes, the EventProcessor process will not be triggered, so the logcat I captured is the log of the next startup. The code is as follows. How can I capture the log when the crash occurs and save it, and then report it with the next startup.
Solution Brainstorm
No response
The text was updated successfully, but these errors were encountered: