Can it possible to get log before print the logcat? - android

Can it possible to get the logs before it print into terminal? Or I want to know how the crash crashlytics takes logs.

Crashlytics doesn't have anything to do with the log system. It hooks the top level exception handler, so that exceptions that are not handled by the program normally are handled by the library.

Related

Log to Logcat before a SIGSEGV /SEGV_MAPERR crash

I have a native library that has a native crash. The crash doesn't happen consistently and I can't reproduce it. I have access to Google breakpad's minidump and last few thousands LogCat lines from the users. The method doesn't crash all the time so I suspect perhaps it crashes because of specific param values that I haven't checked. Unfortunately this is a method that's called a lot so I can't log to LogCat all the time.
I understand that try/catch doesn't work for SIGSEGV. But is there a similar mechanism?
Something like this https://stackoverflow.com/a/2436368/4092412.

crashlytics keeps registering exception after code removed

This problem sounds really weird and it looks is somehow my mistake but isn't
I use crashlytics to keep logs and track exception of the usage of my app
for that i created a lib in the log4j interface which simple calls the crashlytics methods for log events.
On the first version of my lib i add an extra Crashlytics.logException() to every logger.error() in my code. After using it for a while i noticed that this behavior wasn't what i want and I removed the Crashlytics.logException()
BUT CRASHLYTICS KEPT SHOWING EXCEPTIONS ON THAT
I'm really confuse with that and for a long time i thought i was doing something wrong, but after debuging the code thousands of times i came to think that there is something beyond what i see
there is no metion of Crashlytics.logException() in my code, and somehow i still manage to see many errors in my crashlytics dashboard
can someone help me with that?
what events might generate a non-fatal issue on crashlytics dashboard
attach:
- https://pastebin.com/Rbu1ySpd this is the core class of my log lib
- whenever i want to log an even i do `logger.log("something");' in a very log4j way

Crashlytics log not sent

I have Crashlytics properly configured in my app. I can see crash reports.
I tried to add a custom log to the crash reports but I do not see anything in the report.
I tried to move the log out of the uncaughtException handler and in that case I see the logs.
So if I log while the application is running properly then I see the logs in the crash report when the application crashes but if I try to add a log in my uncaughtException handler these logs are not shown.
is this the proper behaviour?
I'm on Android.
To log I just use:
Crashlytics.log(myLog);
myLog is a non-null non-empty string (I checked it)
You are right you need to move the Crashlitycs.start before registering your uncaughtException handler.
I thought that an explanation could be that the logs are sent to the server asynchronously and if the application gets killed before they are sent you don't see them in the crash report. I checked and that is not the case: even if you wait for a while before calling the default handler nothing happen.
The only explanation for now is that Crashlitycs uncaughtException handler is called before mine.
So to fix the issue it is enough to register the handler after calling Crashlytics.start

Xamarin android - Integration with crittercism for unhandled exceptions not working

I've created a bindings project, hooked everything up in my onCreate etc. Everything works except for unhandled exceptions. Let me elaborate on "Everything works" - I can see via crittercism's live stats page that there is indeed an app load, I can also send up "ManagedExceptions" using the "LogHandledException" interface.
I have implemented the ICritterCallback interface and the "CrashedOnLastLoad" boolean is always false. This is wierd cos I can see the app crashes.
I have used these 3 ways to try and get my logs sent to Crittercism. (All 3 crash the app)
Java exception
throw new Java.Lang.IllegalArgumentException("This is a test for critter");
Background exception
.Click += delegate { ThreadPool.QueueUserWorkItem(o => { throw new Exception("Crashed Background thread."); } ); };
Simple .net exception
throw new Exception("Crashed UI thread.");
None of the above are registering as crashes on the next load... weird right?
Maybe the .net runtime is swallowing all the unhandled exceptions then calling exit gracefully on dalvic's runtime... is this possible..?
As a hack for now im implementing the exception handlers for android as per this blog post then calling Crittercism.LogHandledException(Throwable.FromException(e.Exception)); from inside both the events.
It works, but im using Crittercism's handled exceptions for unhandled exceptions.. So when I want to send up real "HandledExceptions" they will be lost in the mess.
So is there any way to send an unhandled exception to Crittercism??
Or is there a way to simulate a crash on android from .net that will send it to Crittercism??
Any help would be much appreciated!
Cheers,
Sam
Co-founder of Crittercism here. We just released an official plugin for Xamarin which should automatically log javascript exceptions (and any other crashes) as unhandled exceptions so you won't run into this problem anymore. You can download the latest version from the Xamarin asset store here:
http://components.xamarin.com/view/crittercism

Android: Usual way to stop and log an unrecoverable error

What is the usual way on Android to stop my application if it has reached an unrecoverable error.
finish() will not do it, since it wont stop any running services or threads. Furthermore I would like to inform the user what has happend and please him to send an error log.
As far as I googled, it seems like there is no way to close my application and open a special crashreport activity or something else to show the user whats going on or send a crash log.
I think you should throw unhandled runtime exception. In such case android will kill all your process. Also I suggest you to use ACRA. This library will help you to get crash report (via email, google docs, etс.) and it can show customizable error dialog to a user.
You should check this out. This could be your solution.
ACRA
Check the basic setup guide to start using the library. ACRA - Basic Setup
While ACRA is an okay solution, if you want to implement your own logging of unhandled exceptions try Thread.setDefaultUncaughtExceptionHandler(). That way you can get any exceptions that are thrown and not caught, and log them the way you like. You need to implement Thread.UncaughtExceptionHandler and pass it to that method.
With an Activity, it would look something like this in onCreate():
getMainLooper().getThread().setUncaughtExceptionHandler(new MyUncaughtExceptionHandler());

Categories

Resources