38

I use:

print('Pls. show this line only');

to debug my flutter apps developed by Android Studio. However, the output in the [Run Tab] is usually something like:

Tens/Hundreds of system debug messages
I/flutter ( 9154): Pls. show this line only
Tens/Hundreds of system debug messages

OK, sometimes it takes me minutes to find my own debug message [Pls. show this line only].

My question is simple, how can we disable [Tens/Hundreds of system debug messages] in the Run Tab of Flutter Project in Android Studio?

Meanwhile, I am using:

print('***************************************************** Pls. show this line only');

as a work around.

halfer
  • 19,824
  • 17
  • 99
  • 186
Kenneth Li
  • 1,632
  • 1
  • 14
  • 19
  • See the Answer in this issue: https://stackoverflow.com/questions/51268169/how-to-search-the-debug-console-in-vscode – Edik Mar 31 '19 at 09:57
  • 2
    Thanks, but I can't see any relationship between my question and the answer provided by you. The question is also different. Mine is: How to DISABLE system debug messages in Android Studio. The one provided by you is: How to SEARCH the Debug Console in Visual Studio Code. As you can see, 'DISABLE' vs 'SEARCH', 'Android Studio' vs 'Visual Studio Code', completely different IDE and question. To clarify, my problem is not searching, but the too many useless system debug messages (sometimes more than a thousand in a minute! Depending on the plugins I added in pubspec). – Kenneth Li Mar 31 '19 at 11:18
  • 1
    For example, I want to check the program flow, so I added print('01'), print('02'), print('03') ......etc in some lines of my codes. I want to see 01, 02, 03 in the Run Tab. Unfortunately, flutter is giving me '01', ..... [One hundred other debug messages]....., '02', .....[more than 300 debug messages]......'03'..... [probably followed by another few hundreds of debug messages, shown by flutter, dart, plugins whatever]. – Kenneth Li Mar 31 '19 at 11:25

7 Answers7

50

In Android Studio....

Before

enter image description here

Settings

File > Settings > Editor > General > Console

Look for section:

Fold console lines that contain

Click the + button on right hand side of scrollable list

Add your substring of what you'd like hidden from the Console output. enter image description here For example in Flutter, I'd remove D/ (i.e. letter D + forward slash) which are emulator debug messages.

After

enter image description here


Baker
  • 24,730
  • 11
  • 100
  • 106
22

I Finally found a Workaround For VS code this is NOT permanent so you have to do it once per session but it helps a lot ...

there is a hidden feature in vs code for debug log filtering and all you need to do is to filter the log to have only the flutter related logs as follows :

1) focus on debug console (by clicking on it )

2) click ctrl + f (nothing will appear but you are now in filtering mode)

3) Type "I/Flutter"

4) hover on the word and click the icon next to it to make it stick .

Vscode debug console filtering for flutter

that's it !

Before :

enter image description here

After:

enter image description here

Ahmed Osama
  • 672
  • 1
  • 8
  • 15
12

In Android Studio:

Gelderson Alves
  • 121
  • 1
  • 3
7

Select the option as shown in case IntelliJ IDEs or Android Studio

setting

Now you can filter as follows

filter

Doc
  • 10,831
  • 3
  • 39
  • 63
  • 8
    What about VS Code? – Robert Williams Feb 22 '20 at 11:47
  • @RobertWilliams console filter here is provided by jetbrains ide or android studio. AFAIK vscode provides logging in web browser only and maybe without filtering. – Doc Feb 24 '20 at 08:18
  • 1
    You are right but what should i do to get clean logs in vs code or atleast in terminal? – Robert Williams Feb 24 '20 at 09:15
  • @RobertWilliams https://github.com/microsoft/vscode/issues/50093. I'm not sure if VS Code is likely to get the ability to add filters though, I think it still aims to be a lightweight editor rather than a big IDE with all features. Look for extensions that allow you to filter logs in vscode. – Doc Feb 24 '20 at 17:34
  • 3
    I can't find that option, did they remove it? – Johannes Pertl Jan 07 '22 at 23:18
  • I can't find that option too! – laprof May 25 '22 at 11:55
4

The android-studio 4.0 has a setting to make this messages go away. Go to File -> Settings -> Languages and Frameworks -> Flutter Uncheck the box stating Enable verbose logging

Settings View

1

Add

I/flutter

in filter of VsCode Debug Console Filter. enter image description here

-1

Rather than filtering the logs, use the release version of the drivers :

flutter run --release

This will avoid printing all the system logs like :

V/MediaPlayerNative(22395): playback complete

And your debug prints will continue to display. Drawback is you won't use anymore the hot reload. Reserved to investigate when the debug prints are flooded in system logs.

Of course applicable to VSCode.

Patrick L
  • 151
  • 1
  • 9