1

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.

MaratMir
  • 99
  • 2
  • 8

1 Answers1

6

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!
Rahul Bhobe
  • 4,165
  • 4
  • 17
  • 32
  • Unfortunately this is not working in 2022. At least not for Revit 2021+ – Jaroslav Daníček May 26 '22 at 12:31
  • This is rather basic and has always worked. Could you provide a minimal reproducible case where this is broken. Please reach out to forge[dot]help[at]autodesk[dot]com. – Rahul Bhobe May 26 '22 at 12:42
  • I am trying to get information that automation plugin has reached execution method: public void Execute(DesignAutomationData data) - so I placend System.Console.WriteLine("Execution started!"); in there and when I download reporUrl from response there is no mention of it just standard logs about Initializing RevitCoreEngine and that it finished sucessfully. – Jaroslav Daníček May 26 '22 at 14:49
  • At the end of report there is an error: Non-optional output [Output.rvt] is missing, which I assume is because of central model saving but all the logic happens before it and all logs should have been written by now and thus appear in log – Jaroslav Daníček May 26 '22 at 14:55
  • I'd like more details to be able to help. The comments section here can't provide the right means to do so. Could you email to `forge[dot]help[at]autodesk[dot]com` and mention my name so it gets forwarded to me? – Rahul Bhobe May 26 '22 at 17:35
  • Eventually I found a problem in addin file I had instead of , now it shows the console logs. Thank you for being willing to help! – Jaroslav Daníček May 26 '22 at 23:35
  • Glad to hear this is resolved! – Rahul Bhobe May 27 '22 at 12:16