登录Revit Design Automation加载项 [英] Logging in Revit Design Automation add-in
问题描述
我想将一些诊断输出发送到默认的report.txt文件.
I want to send some diagnostic output to the default report.txt file.
在某些帖子中显示,异常以某种方式(自动或不自动)记录到此report.txt文件中.
In some posts it is shown that exceptions are logged to this report.txt file somehow (automatically or not?).
此外,我在一些示例中看到人们使用日志记录
System.Console.WriteLine()
,
Also, I see in some samples that people do the logging with
System.Console.WriteLine()
,
我已经尝试过了,但是仍然无法在报告文件中看到它.
I've tried this, but still can't see it in the report file.
您能告诉我,如何实现这一目标吗? 我知道可以创建另一个日志文件并将其发送回结果,但我认为使用此现有的report.txt会更容易.
Could you tell me, how to achieve this? I understand there is an option to create another log file and send it back with the result, but I think it would be easier to use this existing report.txt.
谢谢!
更新:System.Console.WriteLine()有效.
我没有看到输出的原因是我的加载项无法加载.
因此,它根本没有达到这一行代码.
UPDATE: System.Console.WriteLine() works.
The reason why I didn't see the output was that my add-in failed to load.
So, it simply didn't reach this line of code.
推荐答案
使用SystemConsole.WriteLine
确实可以登录Revit appbundles
的Design Automation.发送到标准输出的所有内容都将捕获在您的workitems
report.txt
中.例如.
Logging in Design Automation for Revit appbundles
can indeed be done with SystemConsole.WriteLine
. Anything sent to standard output will be capture in your workitems
report.txt
. For example.
以下代码:
System.Console.WriteLine("Hello World!");
将在report.txt
中生成以下行:
[04/23/2020 19:20:59] Hello World!
这篇关于登录Revit Design Automation加载项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!