blob: 6068b4605d9befb3e60ca44a22103887dbb718a6 [file] [log] [blame] [view]
Nate Fischerb8762b32019-02-12 00:14:411# Net debugging in WebView
2
3## Net log
4
5WebView supports the `kLogNetLog` flag to log debugging network info to a JSON
6file on disk.
7
8*** aside
9For more info on commandline flags, see
10[commandline-flags.md](./commandline-flags.md).
11***
12
13*** note
14**Note:** this requires either a `userdebug` or `eng` Android build (you can
15check with `adb shell getprop ro.build.type`). Flags cannot be enabled on
16production builds of Android.
17***
18
191. Pick a name for the JSON file (any name will work, e.g., `jsonFile=foo.json`)
201. Kill the app, if running
211. Set the netlog flag:
22 ```sh
23 build/android/adb_system_webview_command_line --log-net-log=${jsonFile}
24 ```
251. Restart the app. Reproduce whatever is of interest, and then kill the app
26 when finished
271. Get the netlog off the device:
28 ```sh
29 # appPackageName is the package name of whatever app you're interested (ex.
30 # WebView shell is "org.chromium.webview_shell").
31 appDataDir="$(adb shell pm dump ${appPackageName} | grep 'dataDir=' | sed 's/^ *dataDir=//')" && \
32 adb pull "${appDataDir}/app_webview/${jsonFile}"
33 ```
341. Import the JSON file into [the NetLog
35 viewer](https://chromium.googlesource.com/catapult/+/master/netlog_viewer/)
36
37For more details, see the implementation in
38[AwUrlRequestContextGetter](/android_webview/browser/net/aw_url_request_context_getter.cc).
39For support in the network service code path, see http://crbug.com/902039.