Android studio maximum number of lines logcat
Asked Answered
C

7

34

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

Camphorate answered 23/12, 2014 at 10:58 Comment(0)
C
52

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.

Chloris answered 6/3, 2017 at 10:36 Comment(5)
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 searchChloris
this does not increase the per log.i(...) output length. It remains the same length, and is truncated in my case.Uncalledfor
After more than 4 years, still "logcat" has not been added.Minestrone
Google have now assigned this issue to a developer. It should be implemented soon, and I'll update this answer when it is. -> lolPhonics
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. :(Mayda
N
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.

Needlefish answered 23/12, 2014 at 11:11 Comment(17)
Where do I find this idea.cycle.buffer.size value in Android Studio?Camphorate
@Camphorate Android Studio is based on idea IDE, so it's same to it. You can find it in Android Studio\bin\idea.propertiesNeedlefish
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.Camphorate
@Camphorate 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.Needlefish
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.Camphorate
Tools for coding are often weird, I can only find this way, good luck.Needlefish
This worked for me today with Android Studio v.1.3.1 I set: idea.cycle.buffer.size=50000Crept
@Needlefish 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 ?Bumkin
@Bumkin Have you tired restart your AS?Needlefish
@Needlefish 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 againBumkin
@Bumkin It works for me, but I'm using 64bit version Intellij and gives it 4G memory. Maybe you should give AS more memory?Needlefish
@Needlefish how give AS 4G memory ?Bumkin
@Bumkin 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.Needlefish
@Needlefish sorry i searched for idea.exe.vmoptions in idea.properties text file but does not exist . where should it be ?Bumkin
@Bumkin I mean idea.exe.vmoptions is filename.Needlefish
This variable is no longer available in Android Studio 2.0 idea.propertiesLahr
@uval Then newest version of Android Studio is 1.5.1 according to developer.android.com/intl/zh-cn/tools/revisions/studio.html. Where could I find 2.0 ?Needlefish
F
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.

Fults answered 2/3, 2016 at 16:56 Comment(0)
A
14

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

Aster answered 22/3, 2021 at 10:52 Comment(0)
H
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 
Headley answered 23/12, 2014 at 11:5 Comment(1)
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 <package_name>:V > log.txt codeCamphorate
U
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...

Urban answered 11/10, 2017 at 10:4 Comment(0)
S
2

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

Sonics answered 21/12, 2022 at 10:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.