用于Windows IoT的WebUI(在Raspberry PI上可以看到)具有以下事件跟踪"屏幕:
WebUI for Windows IoT (as seen on Raspberry PI) features the following Event Tracing screen:
我如何从uwp程序写入事件日志,然后再检查那里写了什么?
How do I write into an event log from a uwp program and then later examine what's written there?
此答案(与Windows IoT无关)建议您需要使用标准的System.Diagnostics.Tracing类为了它.该答案所指的示例是为了演示记录到文件.登录到诸如ETW之类的内置工具后,我的想法更多了.
This answer (which is not about Windows IoT) suggests that you need to use standard System.Diagnostics.Tracing classes for it. The sample that this answer is referring to is to demonstrate logging to a file. I'm more after logging to a built-in facility, such as ETW.
按照与示例中类似的逻辑,我正在执行 EventSource.Write ,它不会引发错误,但是看不到书面消息.
Following similar logic as in the sample I'm executing EventSource.Write and it does not throw a error, but written message is nowhere to be seen.
用于Windows IoT的Windows Powershell也不支持Get-EventLog命令.
Windows Powershell for Window IoT does not support Get-EventLog command either.
Windows IoT的开发相对较新,因此互联网上没有太多信息.当前最好的来源是 Mot Iot Samples ,但是尽管有大量的样本,但似乎都没有做任何事件记录.
Windows IoT development is relatively new, so there is not much information in the internet. The best source currently is Ms Iot Samples but despite huge number of samples none of them seem to be doing any event logging.
推荐答案
现在,如果您按问题导航至ETW WebUI页面,则"MyEwtProvider"将出现在下拉列表中.您可以通过调用UwpEventSource.Log.Info/Warn/Debug/Critical/Error("Hello from my porgram");
Now if you navigate to your ETW WebUI page as in your question "MyEwtProvider" will appear in the drop down. You log events in your program by calling one of the UwpEventSource.Log.Info/Warn/Debug/Critical/Error("Hello from my porgram");
如果您不想在不使用WebUI时收集事件,则可以完成.如果您希望能够保留它们并在以后进行分析,请在powershell会话中运行以下命令:
If you do not want to collect the events when you are not working with the WebUI you are done. If you want to be able to persist these and analyse them later, run the following command in your powershell session:
echo y | wevtutil.exe sl MyEwtProvider/Debug /e:true查看其功能此处.现在,您可以通过运行
See what it does here. Now you will be able to retrieve historical data (once you've accumulated them) by running:
wevtutil.exe qe MyEwtProvider/Debug更多推荐
如何在Windows IoT中记录事件?
发布评论