locked
How can the app write to a logfile regardless through which contract it was activated (multiple times)

    Question

  • May app can be activated through launch (naturally), protocol and as a shareTarget. It seems while the launched app is running (meaning not suspended), the shareTarget is instantiated in its own JS VM (within the same wwahost.exe) and cannot share an open log file (opened by the launch instance).

    What strategy is there to have all 3 activations share the same logging file?

    Saturday, June 21, 2014 11:15 PM

All replies

  • According to http://msdn.microsoft.com/en-us/library/windows/apps/Hh758314.aspx:

    The content your app receives from a source app cannot be modified. You can, however, let the system know that your app received the data and indicate when it's been processed.

    It seems that you could save logging information in-memory and pass it back to the calling app for logging purposes.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, June 23, 2014 1:20 PM
    Moderator
  • Uhmmm Matt, I am sorry, how is that related to my question?

    I've already found out that shareTarget activation always launches a new instance of the app, regardless of it running or not. The MSDN is missing this (and plenty others) crucial information.

    Monday, June 23, 2014 2:03 PM
  • "What strategy is there to have all 3 activations share the same logging file?"

    It seems that the crux of your question is how to perform logging operations between a share source and a share target.  Since you can pass information back from the share target to the source, you can perform logging operations in-memory in the target app and then send it to the source app which can then write that information to the log file.

    If this isn't what you're asking, then please clarify what you really want.




    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, June 23, 2014 2:12 PM
    Moderator
  • I dont have a ShareSource. My *app* is implementing ShareTarget, Protocol contracts. I want to log in each of those cases. Which is not possible, when the app was already launched, it opens the logfile (and keeps it open). so the second instance of the app created by Windows for the ShareTarget contract activation cannot open the logfile to append its logging there.
    Monday, June 23, 2014 2:17 PM
  • OK, I understand now...

    While I understand this does not directly answer your question, I must ask: why not open a new logfile as a ShareTarget in the same folder?  Then you can distinguish between the log actions as they are occurring.

    Also, how are you opening the logfile for writing?


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, June 23, 2014 2:59 PM
    Moderator