32

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...

Aster
  • 809
  • 2
  • 8
  • 13

7 Answers7

51

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.

BobbyMick
  • 694
  • 7
  • 11
  • As a side note, I've submitted a feature request to the Android Studio team to request that the logcat keyword brings up this setting when searching settings/preferences of the application. [Add 'logcat' keyword into settings search](https://issuetracker.google.com/issues/63312207) – BobbyMick Jul 05 '17 at 07:39
  • 6
    this does not increase the per log.i(...) output length. It remains the same length, and is truncated in my case. – Beezer Jun 29 '18 at 09:54
  • 2
    After more than 4 years, still "logcat" has not been added. – doctorram Jul 22 '21 at 04:51
  • 1
    _Google have now assigned this issue to a developer. It should be implemented soon, and I'll update this answer when it is._ -> lol – JDenais Nov 23 '21 at 18:20
  • This did not increase the character limit for my logcat, instead splitting the output into smaller chunks by iterating over it works. As a side effect of this change, my Studio stopped resolving imports/dependencies all of a sudden. :( – mehul bisht Jul 28 '23 at 06:57
23

I found this:

I’ve found that in the eighth release of idea IDE, the “Limit Run/Debug Console Output” setting is gone so actually the only way for increasing the console output size is to set the idea.cycle.buffer.size value in idea.properties.

zzy
  • 1,771
  • 1
  • 13
  • 48
  • Where do I find this idea.cycle.buffer.size value in Android Studio? – Aster Dec 23 '14 at 11:49
  • 1
    @Aster Android Studio is based on idea IDE, so it's same to it. You can find it in `Android Studio\bin\idea.properties` – zzy Dec 23 '14 at 12:11
  • When I try to edit this file it keeps complaining that it is open in another program, even when Android Studio is closed and none of the other programs seems to be touching the file. So until now I've not been able to test if changing this setting helps. Would be nice to be able to change this via Android Studio interface itself though, then I wouldn't have to bother with finding the file and the file lock thing. – Aster Jan 06 '15 at 07:56
  • @Aster Restart your computer and do not do anything , now to change the file , I don't think any other program will use this file and Android Studio won't run auto when OS started. And you have spent two weeks to bother with finding the interface , just use several minutes to find how to change a file that locked by other program, there are lots of tools can unlock it. – zzy Jan 06 '15 at 08:11
  • Well, I've been enjoying some vacation last two weeks. So luckily haven't bothered finding the interface for a couple of weeks. Had already thought of this solution with restarting my pc to remove the lock, but for now it was more important to keep working. The point I was trying to make is that it's a bit weird that I can't do this via the GUI. – Aster Jan 06 '15 at 10:49
  • Tools for coding are often weird, I can only find this way, good luck. – zzy Jan 06 '15 at 11:22
  • 1
    This worked for me today with Android Studio v.1.3.1 I set: idea.cycle.buffer.size=50000 – yvolk Aug 09 '15 at 12:51
  • @zzy i am using AndroidStudio 1.3.2 i tired idea.cycle.buffer.size=50000 also dea.cycle.buffer.size=disable .. but does not work for me is there another way ? – Error Sep 28 '15 at 08:07
  • @Error Have you tired restart your AS? – zzy Sep 29 '15 at 03:20
  • @zzy logcat in ddms sometimes scrolling and deleting logging when i tried to change buffer.size yes i restart AS and does not work , so i used Logcat in IDE with filter "show only selected application" and it works now logcat in ddms works fine but may clearing logging again – Error Sep 29 '15 at 03:34
  • @Error It works for me, but I'm using 64bit version Intellij and gives it 4G memory. Maybe you should give AS more memory? – zzy Sep 29 '15 at 03:42
  • @zzy how give AS 4G memory ? – Error Sep 29 '15 at 03:49
  • @Error You can set Jvm args in idea.exe.vmoptions. -Xmx means the max memory you can give to it. The 64bit version is idea64.exe.vmoptions. – zzy Sep 29 '15 at 03:52
  • @zzy sorry i searched for idea.exe.vmoptions in idea.properties text file but does not exist . where should it be ? – Error Sep 29 '15 at 04:06
  • @Error I mean idea.exe.vmoptions is filename. – zzy Sep 29 '15 at 04:32
  • This variable is no longer available in Android Studio 2.0 idea.properties – Amir Uval Mar 22 '16 at 09:41
  • @uval Then newest version of Android Studio is 1.5.1 according to http://developer.android.com/intl/zh-cn/tools/revisions/studio.html. Where could I find 2.0 ? – zzy Mar 23 '16 at 01:25
14

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.

Sufian
  • 6,405
  • 16
  • 66
  • 120
11

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

Gk Mohammad Emon
  • 6,084
  • 3
  • 42
  • 42
4

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 
A.S.
  • 4,574
  • 3
  • 26
  • 43
  • I would like to do this in Android Studio, not in command line. But still I tried to do this with the commandline, but I can't find out how to filter on my applications package name. I would expect this to do the trick, but it didn't: `code` [adb] logcat :V > log.txt `code` – Aster Dec 23 '14 at 11:48
2

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...

0

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

vepzfe
  • 4,217
  • 5
  • 26
  • 46