1

I'm using a EventLogListener in my project. It works fine during Debug mode and it writes to the eventlog. But when using release mode it suddenly stops..

How should I use this in a proper way?

<trace autoflush="true" indentsize="2">
  <listeners>
    <!--<remove name="Default" />-->
    <add name="EventLogListener" type="System.Diagnostics.EventLogTraceListener" initializeData="myproj" />
  </listeners>
</trace>
<switches>
  <!--
        "0" Off            
        "1" Error messages            
        "2" Warning, gives Error and Warning messages            
        "3" Information, gives Error, Warning and Information messages            
        "4" Verbose, gives Error, Warning, Information and Verbose messages
        -->
  <add name="myproj" value="4" />
</switches>
MrProgram
  • 5,044
  • 13
  • 58
  • 98
  • 1
    run visual studio as administrator – Ravi Sharma Feb 25 '16 at 14:14
  • Your configuration looks ok, so here's a shot in the dark - are you looking for `Assert`s or `Write`s and they're not showing up? Is it possible that you're using those functions on `System.Diagnostics.Debug` instead of `System.Diagnostics.Trace`? That would match the behavior you describe, of data showing up in debug mode but not in release. Remember, calls through `System.Diagnostics.Debug` are no-ops in release mode. – Scott Mermelstein Feb 25 '16 at 14:26
  • Beginner mistake..Thank you @RaviSharma – MrProgram Feb 25 '16 at 14:27
  • @emptyman:- most welcome you can accept my answer if you are satisfied with my answer :-) – Ravi Sharma Feb 25 '16 at 14:34

0 Answers0