Cortana 应用程序日志
Cortana App Logss
我正在开发 Cortana 应用程序(Windows 应用程序 C#),我正在使用以下命令打印调试信息:
System.Diagnostics.Debug.WriteLine("voiceCommandName: " + voiceCommandName);
System.Diagnostics.Debug.WriteLine("textSpoken: " + textSpoken);
我的问题是:当我使用 cortana 启动我的应用程序时,我应该在哪里寻找这些 texts/debug 输出?
通常需要在应用程序配置文件中配置跟踪侦听器才能获得 trace/debug 输出。这在你使用 cortana 时不起作用吗?尝试将文件配置为跟踪侦听器 - TextWriterTraceListener。
https://msdn.microsoft.com/en-us/library/system.diagnostics.textwritertracelistener(v=vs.110).aspx
To add a trace listener, edit the configuration file that corresponds to the name of your application. Within this file, you can add a listener, set its type and set its parameter, remove a listener, or clear all the listeners previously set by the application. The configuration file should be formatted like the following example.
<configuration>
<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<add name="myListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="TextWriterOutput.log" />
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
可以使用跟踪侦听器,但您也可以配置 Visual Studio 以等待您的应用启动并自动附加到它:
- 在 visual studio 中,打开项目的属性页面。
- 导航到调试选项页面
- 启用"Do not launch, but debug my code when it starts"(对于c#项目,winjs/c++项目略有不同)
- 保存设置
- 从 VS 开始调试。
- 在 VS 中观察输出 window。
VS 将构建、部署,然后等待。当你使用Cortana激活你的应用程序时,VS会自动连接到你的代码,并可以立即打入断点,或者捕获输出发送到调试输出等
这也适用于代码 运行 作为 Cortana 后台任务的一部分。 Cortana 的设置会注意到是否附加了调试器,并且不会过早地使您的任务超时。
我正在开发 Cortana 应用程序(Windows 应用程序 C#),我正在使用以下命令打印调试信息:
System.Diagnostics.Debug.WriteLine("voiceCommandName: " + voiceCommandName);
System.Diagnostics.Debug.WriteLine("textSpoken: " + textSpoken);
我的问题是:当我使用 cortana 启动我的应用程序时,我应该在哪里寻找这些 texts/debug 输出?
通常需要在应用程序配置文件中配置跟踪侦听器才能获得 trace/debug 输出。这在你使用 cortana 时不起作用吗?尝试将文件配置为跟踪侦听器 - TextWriterTraceListener。
https://msdn.microsoft.com/en-us/library/system.diagnostics.textwritertracelistener(v=vs.110).aspx
To add a trace listener, edit the configuration file that corresponds to the name of your application. Within this file, you can add a listener, set its type and set its parameter, remove a listener, or clear all the listeners previously set by the application. The configuration file should be formatted like the following example.
<configuration>
<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<add name="myListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="TextWriterOutput.log" />
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
可以使用跟踪侦听器,但您也可以配置 Visual Studio 以等待您的应用启动并自动附加到它:
- 在 visual studio 中,打开项目的属性页面。
- 导航到调试选项页面
- 启用"Do not launch, but debug my code when it starts"(对于c#项目,winjs/c++项目略有不同)
- 保存设置
- 从 VS 开始调试。
- 在 VS 中观察输出 window。
VS 将构建、部署,然后等待。当你使用Cortana激活你的应用程序时,VS会自动连接到你的代码,并可以立即打入断点,或者捕获输出发送到调试输出等
这也适用于代码 运行 作为 Cortana 后台任务的一部分。 Cortana 的设置会注意到是否附加了调试器,并且不会过早地使您的任务超时。