Search code examples
adbcommand-promptlogcatfindstr

How do I filter out an error spamming in adb logcat in command prompt?


When I test my VR video playing app, there is always an error spamming when I play a video:

OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_ENUM: enum argument out of range

I can't find anything to fix this error but it does not affect how my app works. However, when I try to debug something, this error keeps spamming and it's hard for me to look at other messages when this happens. I tried to do some research and found that findstr /v may be able to filter out things. So I tried to do these:

adb logcat -s Unity | findstr /v OPENGL

or

adb logcat -s Unity | findstr /v /c:"OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_ENUM: enum argument out of range"

Both seem not able to remove the specific error lines. Am I doing something wrong?


Solution

  • Finally figured it out:

    adb logcat -s Unity | findstr /r/c:"Unity   : [^ ]" | find /v "OPENGL" | find /v "GfxDeviceGLES.cpp"
    

    findstr /v did not work so well with logcat so instead of filtering out using /v, we use /r to get lines that are not blank, and then filter out those error lines with find /v.