MaratMir
MaratMir

Reputation: 99

Logging in Revit Design Automation add-in

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.

Upvotes: 1

Views: 999

Answers (1)

Rahul Bhobe
Rahul Bhobe

Reputation: 4451

Logging in Design Automation for Revit appbundles can indeed be done with System.Console.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!

Upvotes: 6

Related Questions