A switch to configure in the application configuration file in order to log exceptions.
<system.diagnostics>
<switches>
<add name="DotnetProject.Switch" value="4" />
</switches>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="DotnetProjectListener" type="System.Diagnostics.TextWriterTraceListener"
initializeData="c:\LogFile.txt" />
</listeners>
</trace>
</system.diagnostics>
ErrorTrace Class | DotnetProject Namespace