95

When I execute the command

adb logcat

while running the android emulator, all of the old logs blow past and so I figure they are stored in a file somewhere. Is there a command I can run to clear the logs and start fresh? If not, is there some other way to do this?

wojciii
  • 4,253
  • 1
  • 30
  • 39
aarona
  • 35,986
  • 41
  • 138
  • 186
  • Instead of clearing the log - just apply the timestamp filter https://stackoverflow.com/q/45416946/1778421 – Alex P. Jul 14 '18 at 16:53

4 Answers4

135

Have you tried this?

 adb logcat -c

https://developer.android.com/studio/command-line/logcat.html

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Pentium10
  • 204,586
  • 122
  • 423
  • 502
20
adb logcat -c 

didn't do it for me

adb logcat -b all -c

worked

Bob
  • 1,589
  • 17
  • 25
  • This should be the correct answer. If you are analysing SELinux, the other answer won't work. – Hack5 Apr 20 '18 at 18:08
5

Dup of How to empty (clear) the logcat buffer in Android

The following command will clear only non-rooted buffers (main, system ..etc).

adb logcat -c

If you want to clear all the buffers (like radio, kernel..etc), Please use the following commands

adb logcat -b all -c

or

adb root
adb shell logcat -b all -c 
Lava Sangeetham
  • 2,943
  • 4
  • 38
  • 54
2

For me, adb logcat -c was not working and was giving following error :

failed to clear the 'main' log

For this, I first did :

adb shell

Than I did :

logcat -c

then exit the shell. This way I was able to clear logcat when same was not getting cleared from adb logcat -c

aarona
  • 35,986
  • 41
  • 138
  • 186
Tarun Deep Attri
  • 8,174
  • 8
  • 41
  • 56