locked
Logging to Event Viewer on Windows 8.1

    Question

  • I need to log events, crashes to ETW (Event Viewer logs). I see that most suggest writing own file IO wrapper.

    With Windows 8.1, we have new logging capabilities in "Windows.Foundation.Diagnostics" which has classes for "LoggingChannel" and "LoggingSession". But the code sample for them still write to the isolated local storage as files:

    http://code.msdn.microsoft.com/windowsapps/LoggingSession-Sample-ccd52336

    Also, earlier than 8.1, we have "EventSource" and "EventListener" and as per a sample project (http://code.msdn.microsoft.com/windowsapps/Logging-Sample-for-Windows-0b9dffd7/sourcecode?fileId=67472&pathId=1214683397), it also writes to the sample isolated storage as files.

    So, my questions are:

    1. Can we utilize new "Windows.Foundation.Diagnostics" classes to write to ETW?

    2. Are ("LoggingChannel" and "LoggingSession") equivalent to ("EventSource" and "EventListener") ultimately?

    3. Will I still have to write C++ component for writing to ETW?

    Thanks in advance.

    Thursday, March 27, 2014 6:29 AM

Answers

  • 2. More or less...

    3.  I believe you can write most of what you need in C++. 

    Build starts tomorrow - let's wait and see what new capabilities are available when they are released.


    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.

    Tuesday, April 01, 2014 2:42 PM
    Moderator

All replies

  • Hi - as you've seen, the logging capabilities present in Windows Store apps are focused on writing to local storage because the apps themselves are restricted from having access to most of the OS, including event logging, and these logs can be transmitted by the app back to an external server as necessary.  What is your scenario for needing to write directly to the event log?  Is this a Store-submitted app, or an LOB app?


    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.

    Thursday, March 27, 2014 1:11 PM
    Moderator
  • It is for a business and wouldn't be published in the Store, so, I guess I can bypass some of the stricter guidelines. I understand that the samples cannot focus on what is not there in the guidelines, but, can I extend them? If there is no solid answer for (1), could you please suggest the closest thing for questions (2) and (3)?
    Friday, March 28, 2014 4:18 AM
  • 2. More or less...

    3.  I believe you can write most of what you need in C++. 

    Build starts tomorrow - let's wait and see what new capabilities are available when they are released.


    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.

    Tuesday, April 01, 2014 2:42 PM
    Moderator