-2

I want to use the Log function of android to debug my app but no matter I pick Log.d, Log.i, Log.e... the console is always spammed with unneccessary messages from the device and the IDE. Is there any way to disable the other messages or just another way to show my messages in a console where there are no other messages.
In other words: I want the System.out.println() equivalent :D

bishop
  • 360
  • 5
  • 21

2 Answers2

2

You can filter debug messages:

  1. if you use Log.i, then you can filter messages based on log level, i.e. display messages only with level = INFO. There will be much less number of messages with this level compared to DEBUG.
  2. you can show messages only from your application, in that case you'll will not see messages from android OS and other running applications, thus limiting number of outputed to console messages a lot.

You can also apply filtering on log message text, application package name, PID of application or even regex. You can combine these approaches.

Please see https://developer.android.com/studio/debug/am-logcat.html , section Filter logcat messages

gmpf
  • 236
  • 2
  • 11
0

There are two ways to do this:

  • Give the logs within your app a specific tag, and search for that tag in the logcat search area.

  • Run your app in debug mode and switch the debuggable process (in logcat) to your app.

Both of these options will show just your log message to you.

Check https://developer.android.com/studio/debug/am-logcat.html for some more information.