0

I am currently attempting to debug an Android App in Android Studio. However, because of the thousands of unhelpful messages on the logcat system, I am finding it impossible to work with this.

Does anyone know how I can simply insert an equivalent of System.out.println statements into my code so that I can view only these whilst I am debugging my code, instead of all the other random system messages that logcat generates?

Thanks in advance for any help.

Super Hacker
  • 124
  • 2
  • 3
  • 10
  • Its about filtering the `logcat` by tagname. [see][1]. [1]: http://stackoverflow.com/questions/6173985/filter-output-in-logcat-by-tagname – Aown Raza Sep 29 '15 at 11:22
  • A novice question: What does TAG refer to? I have a small Java program that I build a module out of, and this serves as an Android plug-in for another application. I just wanna see a particular function in it is called, so I put a `System.out.println("camera focus set");` in the body of the function. Where am I supposed to see this message? What would be my TAG if I wanted to use `adb logcat` at the terminal? –  Jun 14 '17 at 15:05

2 Answers2

1

Using logcat is the way of doing whate you want. System.out.println will not do the job.

In android studio you can filter the log via the spinner on the top right of the logging window. If you select "Show only selected application" and select your app in the spinner on the top left of the window you will only see logs for your app.

You can also use in your shell. If you want to see only logs for a certain tag, you can use (assuming adb is in your path) adb logcat | grep your_tag

sonic
  • 1,894
  • 1
  • 18
  • 22
1

If you want to see only your custom messages then it is matter of filtering out remaining messages which can be done using tags. This is already described here: How to filter Android logcat by application?

Community
  • 1
  • 1
  • I tried doing this, but it isn't working (showing up as blank now that I have filtered according to my tag). What could be the reason for this? (note that I put the log statement in a process which will be certain to be run) – Super Hacker Sep 29 '15 at 11:27
  • I ended up pursuing this, I was able to fix my issue of showing up as blank by installing the latest version of the platform tools and some other updates, as well as the files for my particular phone version. I think this worked because I recently got a new phone and so the old versions would not have been sufficient. http://stackoverflow.com/questions/14993855/android-adb-device-offline-cant-issue-commands – Super Hacker Sep 29 '15 at 14:45