System.Diagnostics.EventLog replacement? RRS feed


All replies

  • System.Diagnostics.EventLog class is not available in Metro style app. Please refer to http://msdn.microsoft.com/en-us/library/windows/apps/hh441592(v=vs.110).aspx.

    However, you can use win32 API EventWrite to write an event.

    Please check the section 'Windows Event' in Win32 and COM for Metro style apps (diagnostics)

    You can wrap up it in C++ WinRT component.

    Best wishes,

    Robin [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, June 5, 2012 5:50 AM
  • Thanks.

    Is there a better way to log errors in the Metro platform? I seem to remember that there is supposed to be some central repo for them, that includes reporting back to the store dashboard.


    Check out my new C# 2010 All In One for Dummies book at Amazon!

    Wednesday, June 6, 2012 11:29 PM
  • Bump.

    Still finding it hard to believe that I have to write C++ to log an error in JavaScript.


    Gotta be a better way. Maybe I am asking the wrong question?


    Check out my new C# 2010 All In One for Dummies book at Amazon!

    Tuesday, June 19, 2012 2:59 PM
  • Is this even a JS question? System.Diagnostics.EventLog is C#/.net right?

    So if you are looking for a JS solution - there isn't any. But you could extend your JS app by a Windows RT Component (C++, C#) that uses the functions Robin pointed out. If you just want to log an error you could use the window.console for that from JS.

    The central repo you are remembering is probably the WER (Windows Error Reporting) feature, that is still suppored in Metro apps (partly). So you could attach a log file to your error reports that get sent to the store.

    I wonder however, to which location are they sent while our app is not in the store?

    Tuesday, June 19, 2012 5:03 PM
  • The System.Diagnostics namespace is .NET yes, but that's why I asked about a replacement.

    It seems rather unusual that there isn't a logging solution, but I guess that I was just spoiled by .NET. Probably going to feel that a lot in the coming years.

    Would be interested in the Windows Error Reporting question though. Where do those errors go?


    Check out my new C# 2010 All In One for Dummies book at Amazon!

    Wednesday, June 27, 2012 11:07 AM
  • Can I get the code snippet for that?? I want to log events in event viewer for my metro app..

    Friday, October 5, 2012 6:47 AM