Why logcat messages drain

When I test my Android app, I log messages that appear in the LogCat. But messages drop the top of the window, making them impossible to read quickly.

How can I stop this?

+3


source to share


5 answers


The logcat window has a scroll lock that can be used to pause the printout for a moment.

To get complete logcat messages, you can redirect them to a file:



adb logcat >& output.log

+3


source


It depends on what you mean by "leak". If the problem is that the messages are scrolling too fast and you need to stop auto-scrolling at the bottom, you can pause this function in the IDE (or DDMS / Monitor). How you do this depends on your IDE, in IntelliJ you can just click somewhere in the log output to place the cursor, and in Eclipse there is a button above the logcat window to pause the output scrolling (don't forget to bring it back or you don't see new messages).



However, if your problem is that so much data is being logged that you cannot scroll up to see what you need, even if the pause is paused, you need to log less. This is because the Android logcat driver is a 64KB ring buffer. So if you log enough data, it will start overwriting the old log entries and they will disappear before you have a chance to read them.

+2


source


There are several ways:

  • Disable auto scroll function. Click the "Scroll Lock" button to disable this feature.
  • Use command line tools. Run "adb logcat | less" and you can navigate through the results. You can also run "adb logcat> logcat.txt" and then check the logcat.txt file.
0


source


Why don't you filter out the logarithm, so it shows what interests you the most.

You can only display the tags you are interested in using the following syntax (using the adb tool from the command line, also available in the logcat view in Eclipse):

adb logcat TAGTOSHOW:* TAGTOSHOW2:* *:s

      

You can enable as many TAG combinations as you like. Don't forget * .s, which outshines everyone else.

0


source


I prefer teeing for the file:

adb logcat | tee foo.log | grep "YOUR_TAG_OF_INTEREST"

      

This way you get everything you think you are looking for in a terminal window, but if you need to look at the complete logs you saved to a file.

0


source







All Articles