Android : Application with Crash dump report
Asked Answered
M

1

9

I want to develop a log frame work for my application .The things i want to achieve is

  1. Trace the log of my application
  2. Write the log to a text file while tracing the log
  3. Filter the log genrated by my application
  4. Stop the log trace if any error/exception happens after writing the exception to text file

First of all i want to know is this possible ?? I guess by using service we acheive this . if i am wrong please correct me

I refer this project for achieving my needs https://github.com/androidnerds/logger

In this project they are using AIDL to create a service to record the logs .But the saving of file occur only when ever the intent for that .

Seriously i'm new to this AIDL process . The point that confuses me is the sample project doesn't give any permission in manifest to WRITE FILES to storage .But it's able to do that . How did they achieve that??

Even i had gone through these questions

  1. How do I get the logfile from an Android device?
  2. Programmatically get log cat data
  3. Write android logcat data to a file
  4. Save Data of LogCat in android
  5. How to save LogCat contents to file?
  6. How to write entire Logcat in to sdcard?
  7. Filter LogCat to get only the messages from My Application in Android?

But nothing working for me. So please suggest a way to achieve this

Mountainside answered 27/6, 2013 at 11:6 Comment(6)
what have you done so far? did you play with Logger/Handler classes?Philia
well i tried to customize the source code of the project i referMountainside
@Philia i try to modify the source code of github.com/androidnerds/loggerMountainside
why? this is a logcat viewer, not a logging utility...Philia
@Philia ok so can you guide me what should i do ? can i use the approach they used ?? I mean by creating AIDL file to get logsMountainside
read docs of Logger class and if you want some custom logging use addHandler() methodPhilia
F
2

I suggest to take a look at ACRA.

https://github.com/ACRA/acra

At least if you don't want to use it, it's still open source so you can take a look at the code. They do a lot of thing you want to achieve and when looking at the code you may find answers to your question.

I forked ACRA to make some of the things you mention in your questions :

How do I get the logfile from an Android device?

You can log into the acra report file everything you want. We use a special logger that write into the acra logfile. So we know what is the sequence of events that triggered the crash.

Programmatically get log cat data

It's a text file, we use [sections] and timestamp/key=value to display logs to the users before sending the report. Be careful to anonymize your log reports and do not put personnal informations about your users.

Write android logcat data to a file

Save Data of LogCat in android

How to save LogCat contents to file?

How to write entire Logcat in to sdcard?

Filter LogCat to get only the messages from My Application in Android?

Everything that you ask here is already managed by ACRA. There is an extension mechanism that allows you to write your own sender and your own reporter.

Flamboyant answered 2/7, 2013 at 8:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.