×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Jan 2009
    Location
    Melbourne, Australia
    Posts
    2,571

    Best way to provide runtime conditional enabling of code with "token"

    Hi All

    I'm updating Background_Agents_Debugging_Tips_on_Windows_Phone#Capture_logs_and_view_them_in_the_app with help of gregstoll2

    In this he suggested that sometimes it is useful to be able to expose debug information to the end user, but of course you want to hide it most of the time. I suggested one way to do this is to use a URI association to either display the debug page, or to enable debug page in menus. Is there a better/easier way to allow people to enable the page if needed?

    Thanks

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    568

    Re: Best way to provide runtime conditional enabling of code with "token"

    How would a URI scheme work exactly, I'm 99% a Background Agent isn't allowed to invoice any of that as it's UI related, and WP8 only.

    If you wanted a build that display lots of debug info or has an option to download the Background Agent's log, then I'd create a new build configuration for that.

    If you wanted the Release/Store version of your app to display the log, then some apps do something similar when you use their 'Feedback' or 'Report an issue' option - it would create an email and attach the logs.

    Also, what events are logged from the Background Agent are probably the most important bit (previous run successful? execution time? RAM usage?)

  3. #3
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    523

    Re: Best way to provide runtime conditional enabling of code with "token"

    I'd guess that Hamish would make the App itself enable an additional Debug Page when it's launched using a specific URI. The "problem" is that you would need to have an App that is able to call the App with that URI for it to work. If you go for such an approach it'd perhaps be better to use a file type association such as: *.<publisher_name>_<app_name>_debug_token, which would allow you to simply point people to an empty file which would in turn launch the App in the Debug configuration instead of requiring another App in Beta (which times out) or on the store.

    But theothernt's suggestion for display from the front end task is perhaps the easiest to implement and should be sufficient for most use cases.

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    568

    Re: Best way to provide runtime conditional enabling of code with "token"

    Quote Originally Posted by SB Dev View Post
    I'd guess that Hamish would make the App itself enable an additional Debug Page when it's launched using a specific URI. The "problem" is that you would need to have an App that is able to call the App with that URI for it to work. If you go for such an approach it'd perhaps be better to use a file type association such as: *.<publisher_name>_<app_name>_debug_token, which would allow you to simply point people to an empty file which would in turn launch the App in the Debug configuration instead of requiring another App in Beta (which times out) or on the store.
    Oh ok, now I get it ;-)

    Uri's can be launched from a webpage, so if a user was having a problem and you wanted diagnostic info, you could direct them to a support page with the required URI and params.

    Even so, you could put a debug toggle in your app somewhere - if it's 2 or 3 levels deep in your app, most people won't find it unless directed.

  5. #5
    Registered User
    Join Date
    Jan 2009
    Location
    Melbourne, Australia
    Posts
    2,571

    Re: Best way to provide runtime conditional enabling of code with "token"

    Hi Guys

    Firstly thank you.

    I absolutely agree that sending the logs via email, sharing or otherwise is the best approach, and one that is somewhat covered in various examples linked from Reporting_unhandled_exceptions_in_your_Windows_Phone_apps. However there are cases where it is useful to debug in the UI even in a release build - for example where the defect is intermittent and you want to make sure its occurring before emailing stuff off. As this is a "tips" article we provide all the options and let the developer decide.

    Yes, the idea was that the UI would be part of the app itself, not the background agent. The URI could simply enable an app preference which could be used to enable a debugging app menu, and/or turn on logging in the app. This could be read from the agent. I agree that it should be possible to hide the debug toggle - having it in the app preferences might even be the "expected" place. Thanks

    All this discussion makes me think that what we need is a separate topic "Logging on Windows Phone" which delivers a generic and efficient logging framework, tips on "generically" when and what to log, benchmarking on the effects of the particular logging framework. Perhaps also a screen for sharing the logs, for enabling them, and for displaying them in the UI of an app.
    The other articles which discuss various particular aspects of debugging - e.g. Reporting_unhandled_exceptions_in_your_Windows_Phone_apps and Background_Agents_Debugging_Tips_on_Windows_Phone#Capture_logs_and_view_them_in_the_app would then explain the specific domain issues (e.g. how to hook into the exceptions, what you want to log in a scheduled task etc).

    Thoughts? Is there an existing logging framework that is generally recommended ... or are there sets that are recommended? Is there tooling for automatic instrumentation? Or should we just use one like provided in background agents?

    Regards
    H

  6. #6
    Registered User
    Join Date
    Jan 2009
    Location
    Melbourne, Australia
    Posts
    2,571

    Re: Best way to provide runtime conditional enabling of code with "token"

    AlexSorokoletov commented in the wiki article about logging frameworks:

    I'm concerned about following things:
    1. Easy to use
    2. Small memory footprint, less dependencies
    3. Log format - option to view and "understand logs" (for now I'm trying to write in log4j format and then use any of those "desktop" log viewers
    4. Sharing log from production device (app installed from beta or store) to developers. Take into account log could be very large.
    5. Thread safety

    Anyone else have any thoughts on the topic?

  7. #7
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    568

    Re: Best way to provide runtime conditional enabling of code with "token"

    I would be very sure there's an existing logging solution we can use (there are tons for .NET generally), but I have no preference - and probably won't have time to look into this for a week or so.

    Any thoughts SB Dev?

  8. #8
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    523

    Re: Best way to provide runtime conditional enabling of code with "token"

    I've not looked into the area so far. I've only got a very simple implementation running at the moment and it'd likely not be suitable for the use case described.

  9. #9
    Registered User
    Join Date
    Jan 2009
    Location
    Melbourne, Australia
    Posts
    2,571

    Re: Best way to provide runtime conditional enabling of code with "token"

    Quote Originally Posted by theothernt View Post
    I would be very sure there's an existing logging solution we can use (there are tons for .NET generally), but I have no preference - and probably won't have time to look into this for a week or so.
    I'm sure there is too - if you think you can have a quick review in a week or so that would be fine.

    I like the idea of using a standardised log format.

Similar Threads

  1. Replies: 6
    Last Post: 2011-05-20, 10:43
  2. Replies: 6
    Last Post: 2011-04-14, 12:56
  3. How to "freeze" code execution in "onClicked" slot?
    By evgeny_123 in forum [Archived] Qt Quick
    Replies: 7
    Last Post: 2011-02-24, 12:06
  4. Carbide.c++ express import of .mmp "Error detected on token usage"
    By jimgilmour1 in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 3
    Last Post: 2006-09-18, 17:23
  5. Replies: 1
    Last Post: 2003-03-17, 09:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×