I've been having a hard time finding information on this subject in both outside research and on StackOverflow/Progammers.StackExchange
so I figured I'd ask here. This it mostly a 'best practice' question, but I am interested in the performance repercussions as well.
Background:
I currently am using the NLog logging framework in a WinForms
application with a supporting Windows Service component. I have a lot of tracing log statements throughout the application for my testing which I monitor via UDP output. Errors/Warnings also go to the Event Log and rolling log files, which also include the INFO level as well.
Question:
What is the best practice to handle all of the logging code when compiling the release version of the application? Should all trace/debug code be removed from the application since it could negatively affect performance? Since NLog logging is controlled by XML
configuration files, would removing the listeners for trace/debug logging eliminate the potential performance pitfalls? Should I have been placing trace/debug logging elements within preprocessor directives to prevent them being compiled into releasable production code?