通过logcat在Android上调试WebView(Ionic)应用程序 [英] Debugging a WebView (Ionic) app on Android via logcat
问题描述
这个主题有几个问题,但是没有一个问题能解决我遇到的特殊问题。
There are several questions about the subject, however not one of them seems to address the particular problem I'm having.
我正在开发一个应用程序Cordova / Ionic和打印调试信息我使用 adb logcat CordovaLog:D *:S $ c $输出
console.log()
c>工作正常,直到一些更新。现在我似乎不知道如何正确过滤logcat的输出,所以我只能从我的应用程序获得调试信息。
I'm developing an app with Cordova/Ionic, and printing debugging info I was outputting with console.log()
by using adb logcat CordovaLog:D *:S
was working just fine until some updates. Now I can't seem to figure out how to properly filter logcat's output so I could only get the debugging info from my app.
日志记录本身工作。如果我没有设置过滤器和重定向输出到文件,我可以看到我的调试信息在所有其他调试消息,它看起来像这样:
Logging itself works. If I set no filters and redirect output to a file, I can see my debugging info among all the other debug messages, and it looks like this:
I/Web Console: Event triggered: device.ready:1
记录到屏幕也可以工作,但速度约为每秒100行。我尝试了至少以下过滤输出:
Logging to screen also works, but at a rate of approximately 100 lines per second. I've tried at least the following to filter output:
adb logcat -s "Web Console"
adb logcat "Web Console":V
adb logcat "Web Console":*
adb logcat -s Web
adb logcat Web:V
adb logcat "myApp":V
adb logcat myApp:V
adb logcat -s myApp
...我已经忘了。
... and probably others I've already forgotten. They either print absolutely nothing, or absolutely everything from the system services.
我在Windows上,所以我不能 grep
,我调试的设备运行Android 4.2.2,所以我不能使用GapDebug,也似乎不可能通过 chrome://访问设备的日志
I'm on Windows so I can't grep
, and the device I'm debugging on is running Android 4.2.2 so I can't use GapDebug, and neither does it seem to be possible to access the device's log via chrome://inspect
in Chrome.
我真的很想了解如何过滤logcat的输出。
I really, really would like to understand how filtering logcat's output works. I'm not willing to log everything to a file and then shift through that.
推荐答案
似乎 logcat
无法正确解析带空格的标签名称。所以我建议在设备上使用 grep
:
It seems that logcat
can not properly parse tag names with whitespaces. So instead I suggest using grep
on the device:
adb shell "logcat | grep 'Web Console'"
这篇关于通过logcat在Android上调试WebView(Ionic)应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!