简体   繁体   中英

UWP C# How to Write to Event Log

I am trying to add an EventLog to my UWP app, but I was not able to reference it in System.Diagnostic. After doing some research, I'm starting to think that it is not apart of UWP's API. I have found alternatives to writing an EventLog using both FileLoggingSession and LoggingSesssion, but was wondering if there is a way to write to a windows EventLog? If not, is there an Open Source or NuGet package that will do this for me?

The sandboxed nature of UWP apps means you don't have direct access to the event log. There are a number of ways around it, but they are not valid in a store-deployed scenario.

You can write the Action<string> in a static class and write

public Action<string> reminder;

Reminder: add the code that writes the file in the Local Folder, and you can see the file that you write.

And I write the error in catch(Expetion e) and write reminder=e.Message;

But it cannot see it running.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM