Background task does not write to console.log?


  • I am exploring the background sample.  The background task script has some calls to console.log to show the status (starting, etc) but the messages do not appear for me even though I can see the task is being executed through the progress indicators that are passed back to the application thread.  Am I missing something in VS to prevent console.log messages?
    Saturday, April 7, 2012 3:36 PM


  • Hi JR,

    You would need to be attached to the background task in order to see the console logging from that process. 

    From this forum thread:http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/f9d0e832-b861-4134-9377-bb271edd904a

    This should allow you to set a BP in your background task and attach to it:

    Update: Here is how you can debug a background JS process.

    I used the BackgroundTask sample to try this out since it was easier for me to repro.


    1. In the Solution Explorer, right click on the BackgroundTaskSample project

    2. Choose Properties

    3. Click the Debug nav tab on the left side

    4. Check the box "Do not launch, but debug my code when it starts" or if this is a C# app, choose the Debugging, item and set "Launch Application" to "No"

    5. Repeat steps 1-4 except for the BackgroundTask project

    6. Hit the Save All Icon

    7. Set a bp in the background task I chose the top of the Run() function

    8. Hit F5 to start debugging (note that the project does not start your app, but it says debugging.

    9. Launch your app from the Start screen by hitting the tile or typing the name of the app

    10. Register by hitting the Register button and kick off the background task by unplugging and reconnecting your network cable in this case).

    11. You will hit the BP! -Jeff


    Jeff Sanders (MSFT)

    Monday, April 9, 2012 12:59 PM