Page 1 of 1

Publish vs Debug build

Posted: Thu Apr 13, 2023 4:29 pm
by AllanH
Q: Is there a way to determine if I am compiling a debug build vs publishing?

I would like to automatically disable verbose logging when I publish but leave it on when developing/debugging. In Visual studio for C++, the compiler defines _DEBUG and NDEBUG respectively to support such compile-time configuration changes.

I could not find anything in ModuleDesignerTestClient.log and ModuleDesigner.log that indicates something along the lines of a defined variable.

Any suggestions would be appreciated

Re: Publish vs Debug build

Posted: Thu Apr 13, 2023 5:29 pm
by seal58
Hi,

you will have to build your debugging helpers yourself. During development I use to add some code, that creates logs or handles extra controls. This extra code as well as selection of log messages can be switched on and off with IF ( ) statements.

For example I use one boolean variable to switch whole debugging helpers on and off. Several other values are used to config debugging environment.
When module is finished, one can delete such extra code. As I know, Java compiler is so smart, that it ignores code segments that never can be run through because of everlasting FALSE conditions.

BTW: Even when you start debugging with ctrl+F5 (without child process) instead of F5, the code can send log messages with Log() anyway. These will not appear in VMD output pane, but in ModuleDesignerTestClient.log.

Re: Publish vs Debug build

Posted: Fri Apr 14, 2023 4:22 pm
by AllanH
Thanks for the comments. I do have a logging framework that I manage with a few 'final boolean' variables to include or exclude at build time. I had hoped to automatically remove my verbose logging when building a release as the overhead shouldn't be in a published module. Thanks again.