Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My app's logcat output keep disappearing due to other unwanted outputs flooding logcat

While developing my app on a Moto G, I often encounter tens of thousands of below messages flooding the log.

E/MM_OSAL (  275): isSamePayload Sync byte(0x47) not found!! m_nCurrOffset=0
E/MM_OSAL (  275): isSamePayload Sync byte(0x47) not found!! m_nCurrOffset=0
... repeated 20000 times in a span of 12 secs
D/WifiStateMachine(1004): processMsg: L2ConnectedState
D/WifiStateMachine(1004): handleMessage: X
D/WifiStateMachine(1004): handleMessage: E msg.what=131155
... repeated 15000+ times all interspersed together

Now, of course I have set Logcat filters but all these messages are filling up the logcat buffer and my own debug messages keep disappearing.

Observations

  • This happens irrespective of using Android Studio or Eclipse. This means the issue is with Logcat and not how the IDE handles it I suppose.
  • According to this question, I am supposed to increase the default logcat buffer size or set it to infinite (0), but this still does not solve due to the sheer rate at which these spams keep piling up.
  • If I reboot the phone, it clears up the logcat only for a few minutes before the spams catch up.

How do I stop these unwanted messages from overflowing Logcat buffers?

Update: Okay I think I have found some clue. The logcat buffer is not getting cleared

$ ./adb logcat -g
/dev/log/main: ring buffer is 256Kb (255Kb consumed), max entry is 5120b, max payload is 4076b
/dev/log/system: ring buffer is 256Kb (0Kb consumed), max entry is 5120b, max payload is 4076b
$ ./adb logcat -c
$ ./adb logcat -g
/dev/log/main: ring buffer is 256Kb (255Kb consumed), max entry is 5120b, max payload is 4076b
/dev/log/system: ring buffer is 256Kb (0Kb consumed), max entry is 5120b, max payload is 4076b

As you can see, the main buffer is not getting cleared - maybe that's the reason my app's messages are not making it to logcat.

like image 764
S B Avatar asked Nov 11 '22 07:11

S B


1 Answers

You can do the following to counteract this:

1) Go to Eclipse-> DDMS-> Devices and click your device list.

OR

2) Assuming you have adb installed, go to your command prompt and type

adb logcat > logs.txt

This will dump the logcat messages into the logs.txt file, and then you can open it and parse through the logs for your debug messages to get what you want.

like image 88
SoulRayder Avatar answered Nov 15 '22 06:11

SoulRayder