Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent Android logcat clear during app restart

I am using Android Studio 1.5.1 and it clears the logcat buffer during app restart. Now my app crashes, restarts and I don't see what happens just before the crash.

Is there a way for logcat in Android Studio not to clear during the app restart? I wanted to increase the logcat buffer size, but could not find the option it in the current version of AS.

like image 724
jpou Avatar asked Feb 15 '16 17:02

jpou


People also ask

How do I stop Logcat from clearing?

Prevent clearing the log when the app crashes By default when the app got crashed the logcat clear's in the android studio. To prevent this, click the right end chooser(Filter Configuration chooser) in the logcat tab then select Edit Filter Configuration option and enter current app name and package name.

How do I freeze Logcat?

If you click on the logcat output before scrolling it should stop automatically scrolling. Such an annoying and obvious little bug. As stated in @taotao's answer: Triple click the line & voilla!

What is Logcat buffer?

Logcat is a command-line tool that dumps a log of system messages, including stack traces when the device throws an error and messages that you have written from your app with the Log class. This page is about the command-line logcat tool, but you can also view log messages from the Logcat window in Android Studio.

Why is my Logcat not showing anything in Android?

Solution 1: Restarting your Android StudioIn your IDE Go to File > Invalidate Caches and Restart > Invalidate and Restart. This Solution will clear all the caches of Android studio IDE and restart it automatically, By the method, there are 80% change that Logcat will start work as before.


2 Answers

I had the same issue, but looks more like a feature than a bug:

In AndroidStudio, the default setting for the Logcat window seems to be "Show only selected Application" (top right corner of the Logcat window)... which is looking at the log of the selected process (your current launch by default). So when your app crashes during testing, that process is gone, so the filter clears the log.

Instead, select "Edit Filter Configuration..." and set up a filter for your app, eg:

  • FilterName: MyApp
  • PackageName: com.example.myapp (<< replace with your app's package name)

...and then select that filter for future runs. This should keep the log there for you, even after the app crashes.

duplicate

like image 124
Sinkeat Avatar answered Oct 12 '22 20:10

Sinkeat


In the device's developer settings, locate the option for "Always show crash dialog" and enable it:

"Always show crash dialog" enabled in developer options

By doing so, the application will not be restarted and the log for the process (before it died) will not be cleared in Android Studio.

like image 38
Paul Lammertsma Avatar answered Oct 12 '22 22:10

Paul Lammertsma