Details

    • Type: Sub-task Sub-task
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: iOS
    • Labels:

      Description

      Currently, when using the awesome remote debugger provided by apple (connecting on localhost:9999 with safari) with :

      // enable remote debugging
      #if TARGET_IPHONE_SIMULATOR
      [NSClassFromString(@"WebView") _enableRemoteInspector];
      #endif

      I do not get any console log/warn/error output. I guess it is caused by the Xcode logging adaptater.

      The remote webinspector is really superior to Weinre currently as it does provide realtime dom inspection (weinre only displays initial dom, not what was built by Sencha Touch for instance).

      Also I've seen that you have made some progress on error tracing (CB-535), this would be also awesome as it is a really major issue. Since playing with api's that can't be debugged via a desktop Webkit is a real nightmare today.

        Issue Links

          Activity

          Olivier Louvignes created issue -
          Hide
          Shazron Abdullah added a comment -

          Why is this a Cordova issue? "I do not get any console log/warn/error output. I guess it is caused by the Xcode logging adaptater." --> this is outside our control, if so.

          Show
          Shazron Abdullah added a comment - Why is this a Cordova issue? "I do not get any console log/warn/error output. I guess it is caused by the Xcode logging adaptater." --> this is outside our control, if so.
          Hide
          Shazron Abdullah added a comment -

          Check out pmuellr's (creator of Weinre) plugin that enable this (essentially the same as what you are doing), and perhaps he can answer better: https://github.com/pmuellr/phonegap-plugins/tree/web-inspector/iOS/WebInspector

          Show
          Shazron Abdullah added a comment - Check out pmuellr's (creator of Weinre) plugin that enable this (essentially the same as what you are doing), and perhaps he can answer better: https://github.com/pmuellr/phonegap-plugins/tree/web-inspector/iOS/WebInspector
          Hide
          Olivier Louvignes added a comment -

          About the Xcode logging adapter, i guess what i meant was "How Cordova overrides native console.log methods to push them to Xcode". So i thought maybe it could come from Cordova but not really sure of this. I'll check this plugin out. Thanks.

          Show
          Olivier Louvignes added a comment - About the Xcode logging adapter, i guess what i meant was "How Cordova overrides native console.log methods to push them to Xcode". So i thought maybe it could come from Cordova but not really sure of this. I'll check this plugin out. Thanks.
          Hide
          Shazron Abdullah added a comment -

          Ah ok, now I get it. There would have to be a setting somehow to disable console.log in Cordova if this web inspector is turned on.

          Show
          Shazron Abdullah added a comment - Ah ok, now I get it. There would have to be a setting somehow to disable console.log in Cordova if this web inspector is turned on.
          Hide
          Patrick Mueller added a comment -

          One of the fixes for https://issues.apache.org/jira/browse/CB-348 should be to always delegate to the existing console functions, if available AS WELL AS call our own overrides. I think/hope this may fix THIS particular issue.

          There are actually a number of issues with "real remote inspector" usage within Cordova apps - or actually anywhere. Not sure I want to deal with this in Cordova proper - I think a better place to hack on this would be the plugin that Shaz pointed to. Pull requests accepted!

          I will add a little note that if indeed you are seeing that "weinre only displays initial dom, not what was built by Sencha Touch for instance", then that's a weinre bug. Way back when, the dom was not updated in a useful way, but it should be now.

          Show
          Patrick Mueller added a comment - One of the fixes for https://issues.apache.org/jira/browse/CB-348 should be to always delegate to the existing console functions, if available AS WELL AS call our own overrides. I think/hope this may fix THIS particular issue. There are actually a number of issues with "real remote inspector" usage within Cordova apps - or actually anywhere. Not sure I want to deal with this in Cordova proper - I think a better place to hack on this would be the plugin that Shaz pointed to. Pull requests accepted! I will add a little note that if indeed you are seeing that "weinre only displays initial dom, not what was built by Sencha Touch for instance" , then that's a weinre bug. Way back when, the dom was not updated in a useful way, but it should be now.
          Shazron Abdullah made changes -
          Field Original Value New Value
          Link This issue depends on CB-348 [ CB-348 ]
          Patrick Mueller made changes -
          Parent CB-348 [ 12546784 ]
          Issue Type Bug [ 1 ] Sub-task [ 7 ]
          Patrick Mueller made changes -
          Assignee Shazron Abdullah [ shazron ] Patrick Mueller [ pmuellr ]
          Hide
          Steve Sims added a comment -

          I'd love to be able to see console.log (plus console.error and console.warn) message coming out of the webkit remoteInspector.

          My typical console.log calls are often something like this:
          console.log("Current state is %o", stateObject);

          Inside the webkit inspector the stateObject would be interpolated into the console output. Such log messages through Cordova's logging just end up being "Current state is %o", which are fairly useless.

          Unfortunately weinre isn't a good alternative to the inbuilt remote inspector for my needs because all my JS code uses ES5 strict-mode, which weinre isn't compatible with.

          At the simplest level, it would be nice to just have a way to disable cordova's console.log override.

          Show
          Steve Sims added a comment - I'd love to be able to see console.log (plus console.error and console.warn) message coming out of the webkit remoteInspector. My typical console.log calls are often something like this: console.log("Current state is %o", stateObject); Inside the webkit inspector the stateObject would be interpolated into the console output. Such log messages through Cordova's logging just end up being "Current state is %o", which are fairly useless. Unfortunately weinre isn't a good alternative to the inbuilt remote inspector for my needs because all my JS code uses ES5 strict-mode, which weinre isn't compatible with. At the simplest level, it would be nice to just have a way to disable cordova's console.log override.
          Hide
          Olivier Louvignes added a comment -

          Steve, I built a quick patch for cordova-js to correctly sprintf content of console output:
          https://github.com/apache/incubator-cordova-js/pull/10
          It is really helpful, even in XCode.

          But it looks like no-one is reviewing pull requests on this repo (might as well deactivate them... .).

          Show
          Olivier Louvignes added a comment - Steve, I built a quick patch for cordova-js to correctly sprintf content of console output: https://github.com/apache/incubator-cordova-js/pull/10 It is really helpful, even in XCode. But it looks like no-one is reviewing pull requests on this repo (might as well deactivate them... .).
          Hide
          Steve Sims added a comment -

          Thanks Olivier, that patch is a distinct improvement over the default cordova logging output.

          The remote inspector would still be more useful, since it allows browsing objects rather than just outputting [object Object] - however any improvement is welcome.

          Show
          Steve Sims added a comment - Thanks Olivier, that patch is a distinct improvement over the default cordova logging output. The remote inspector would still be more useful, since it allows browsing objects rather than just outputting [object Object] - however any improvement is welcome.
          Hide
          Patrick Mueller added a comment -

          I'm mid-way through getting a better console into Cordova.

          The current plan, for iOS, is to implement a console object that both delegates to the original console, and writes to the new Logger plugin. With the sprintf() style expansion. I may be able to squeeze this in for 1.8.

          There are some additional plans, if you check the related bugs, on other platforms.

          Sorry about the pull requests - there's some magic whereby an email will show up in our list for pull requests, but that's the extent of the magic. We can't actually accept them, and the only thing to do - eventually - is for the submitter to close them. I either missed the pull request on the list, or it never made it to the list (broken magic). In any case, I think I have this functionality in the base at this point, so don't see the need to pull the commit.

          re: the unsupported remote inspector with the iOS 5.x simulator - I think you will find - but I'm not 100% sure - that the console just simply does not work there. There's a few other things that don't work as well. Even once we have the new console going (and delegating to the original console), it's STILL not going to show up in the remote web inspector.

          Show
          Patrick Mueller added a comment - I'm mid-way through getting a better console into Cordova. The current plan, for iOS, is to implement a console object that both delegates to the original console, and writes to the new Logger plugin. With the sprintf() style expansion. I may be able to squeeze this in for 1.8. There are some additional plans, if you check the related bugs, on other platforms. Sorry about the pull requests - there's some magic whereby an email will show up in our list for pull requests, but that's the extent of the magic. We can't actually accept them, and the only thing to do - eventually - is for the submitter to close them. I either missed the pull request on the list, or it never made it to the list (broken magic). In any case, I think I have this functionality in the base at this point, so don't see the need to pull the commit. re: the unsupported remote inspector with the iOS 5.x simulator - I think you will find - but I'm not 100% sure - that the console just simply does not work there. There's a few other things that don't work as well. Even once we have the new console going (and delegating to the original console), it's STILL not going to show up in the remote web inspector.
          Hide
          Steve Sims added a comment -

          Thanks for the response Patrick. Looking forward to your enhanced console.

          As for the remote inspector - I would have sworn that I'd seen console.log messages in there, but on reflection I think that's probably my imagination playing tricks with me.

          Show
          Steve Sims added a comment - Thanks for the response Patrick. Looking forward to your enhanced console. As for the remote inspector - I would have sworn that I'd seen console.log messages in there, but on reflection I think that's probably my imagination playing tricks with me.
          Gavin made changes -
          Link This issue depends on CB-348 [ CB-348 ]
          Gavin made changes -
          Link This issue depends upon CB-348 [ CB-348 ]
          Hide
          Olivier Louvignes added a comment -

          Any news on this? I'm currently trying to disable cordova's hijack of console in a regular chrome.

          Tried this:

          console.useConsole(true);
          console.log('test');
          RangeError: Maximum call stack size exceeded

          Any ideas?

          Show
          Olivier Louvignes added a comment - Any news on this? I'm currently trying to disable cordova's hijack of console in a regular chrome. Tried this: console.useConsole(true); console.log('test'); RangeError: Maximum call stack size exceeded Any ideas?
          Hide
          Patrick Mueller added a comment -

          Might want to post to the dev list to ask - I seem to remember seeing some changes to the logging occurring recently, but I'm not sure what they were. Presumably there is another bug open re: the console that someone is/was working on.

          Show
          Patrick Mueller added a comment - Might want to post to the dev list to ask - I seem to remember seeing some changes to the logging occurring recently, but I'm not sure what they were. Presumably there is another bug open re: the console that someone is/was working on.
          Andrew Grieve made changes -
          Assignee Patrick Mueller [ pmuellr ] Ian Clelland [ iclelland ]
          Hide
          Andrew Grieve added a comment -

          This is now fixed in 3.0 by not installing the logger plugin

          Show
          Andrew Grieve added a comment - This is now fixed in 3.0 by not installing the logger plugin
          Andrew Grieve made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]

            People

            • Assignee:
              Ian Clelland
              Reporter:
              Olivier Louvignes
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development