Logging in Revit Design Automation add-in

一笑奈何 提交于 2020-06-17 15:52:20

问题


I want to send some diagnostic output to the default report.txt file.

In some posts it is shown that exceptions are logged to this report.txt file somehow (automatically or not?).

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.

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.

Thanks!

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.


回答1:


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.

The following code:

System.Console.WriteLine("Hello World!");

Will generate the following lines in the report.txt:

[04/23/2020 19:20:59] Hello World!


来源:https://stackoverflow.com/questions/61384581/logging-in-revit-design-automation-add-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!