0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【adb logcat】windows+javascriptのandroid開発でconsole.logのログ出力をフィルタする方法

Posted at

解決したいこと

windows 環境でjavascript を使ってandroid アプリを開発しているとき、console.log の出力を確認したかった。
具体的には、cordova を使って開発していた。
デバック方法としては、chrome を使うやり方もあるがadbを使ったほうがアプリを再起動しても常に監視できるので楽。

$ adb logcat | grep CONSOLE

調べるとLinux環境では上記のようにgrep hogeを使ってフィルタしてあげればhogeが含まれる文章だけが表示される
でもwindowsではgrepは使えない...

解決方法

$ adb logcat -s chromium:I

logcat に関する公式の説明を見ると、普通にコマンドからフィルタできた。
上記のコマンドは実際にcordova のconsole.logをフィルタしたい場合の指定の仕方。
フィルタに関する説明は、

の**「ログ出力をフィルタリングする」**から見ることができる。

指定の仕方だが、まずフィルタをかけずにlogcatしてフィルタしたい目的のconsole.logを見つける。

$ adb logcat
>  I/ActivityManager(  585): Starting activity: Intent { action=android.intent.action...}

I,ActivityManagerは任意に変わっているはずなので、それを確認して

$ adb logcat -s ActivityManager:I

とすれば目的のconsole.logだけ出力される

参考サイト

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?