Aster
Aster

Reputation: 877

Android studio maximum number of lines logcat

I'm testing with a real device connected to Android Studio. Because of multithreading behavior that I don't want to interrupt I've added lots of log statements to my code to find out what's happening. In logcat I see the statements comming, so far so good.

After running my complete test I found out that the beginning of my logging is missing! Seems to me that Android Studio deletes the earliest lines of logging when the log is in danger of growing too big. Since I would like to retrieve my whole logfile after a testrun (so I can do something else in the meantime), I would like to increase the number of lines Android Studio keeps.

Do you know where I can adjust this maximum number of lines logcat has to store? I hope/pray/assume that there is such a parameter, because I can't find it yet...

Upvotes: 35

Views: 40022

Answers (7)

vepzfe
vepzfe

Reputation: 4527

You find the setting to change the buffer size for the logcat under Tools > Logcat. Here you can set the buffer to any size you desire.

enter image description here

Upvotes: 2

BobbyMick
BobbyMick

Reputation: 714

I'd like to add an update to this question, in case anyone else is looking for a way to change this on or after March of 2017.

The latest version of Android Studio, version 2.3, now has an option to change the size of the cyclic logcat buffer in Settings/Preferences.

Go to Settings/Preferences > Editor > General > Console and enable the Override console cyclic buffer size (1024KB) option. Once you enable this setting, you can enter a value in kilobytes for the logcat buffer.

It would have been better if Google added the word "logcat" in there, because it can't be found with a search of the preferences unless you specifically enter "console" or "cyclic", etc.

Edit: Google have now assigned this issue to a developer. It should be implemented soon, and I'll update this answer when it is.

Edit 2: According to Google, they have now added a setting for logcat's buffer to Dolphin Canary 6 release, and the issue is now marked as fixed.

Upvotes: 53

Gk Mohammad Emon
Gk Mohammad Emon

Reputation: 6938

Go to File -> Settings -> Editor -> General -> Console and checked Override console cyclic buffer size and make it 20399 KB (It is actally the maximum value). Then finally Restart your IDE.

enter image description here

Upvotes: 14

missmissyou
missmissyou

Reputation: 41

According to http://tools.android.com/tech-docs/configuration, it could be modified at

  • AS

  • Help

  • Edit Custom Properties

This actually creates the idea.properties file...

Upvotes: 2

Santiago Battaglino
Santiago Battaglino

Reputation: 487

Like @zzy says... edit file: PATH_TO_ANDROID_STUDIO\bin\idea.properties

Here are properties you can customize in your own idea.properties file: http://tools.android.com/tech-docs/configuration

#---------------------------------------------------------------------
# This option controls console cyclic buffer: keeps the console output size not higher than the specified buffer size (Kb).
# Older lines are deleted. In order to disable cycle buffer use idea.cycle.buffer.size=disabled
#---------------------------------------------------------------------
idea.cycle.buffer.size=1024

Modify above value to 2048 or whatever you need.

Upvotes: 14

A.S.
A.S.

Reputation: 4574

You could start the logcat in a terminal: developer.android.com/tools/help/adb.html#logcat

[adb] logcat [option] ... [filter-spec] ... 

and pipe it to a txt file

win

PATH\TO\YOUR\ADB\ adb.exe logcat > log.txt

or

linux

PATH\TO\YOUR\ADB\ adb logcat| tee log.txt 

Upvotes: 4

Related Questions