[WKWebView] Enable logging of JavaScript errors to the app (system) log

Originator:radexpl
Number:rdar://27762233 Date Originated:09-Aug-2016 10:56 AM
Status:Open Resolved:
Product:iOS SDK Product Version:
Classification:Feature (New) Reproducible:Not Applicable
 
JavaScript `console.log`s, exceptions, and errors are not logged to the app (system) log.

They only exist in their own web console log. This makes it cumbersome to view them in apps that use web views, because we have to *first* connect to the web view using Web Inspector, and only then we can reproduce an issue, or observe an important diagnostic log or other web view error.

It should be possible to enable, perhaps as a development/diagnostic switch, redirecting of all web view logs and errors to the system log, so one can see them in Xcode pane or on devices through the system log.

There already exists a private API: _logsPageMessagesToSystemConsoleEnabled on WKPreferences to allow this. I suggest this API be made public.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!