I have a 3rd-party app that logs (verbosely) to the users' Appdata folder. I'd like to augment that behavior to also record Errors to the EventLog. How can I accomplish this? Note that the app's source code is not available; I can only modify the .config file.
Here's the original .config file. It logs verbosely to a .log file:
<system.diagnostics>
<switches>
<add name="Default" value="Verbose"/>
</switches>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="CPLog"
type="ClientApp.Common.Logging.MultiProcessFileTraceListener, ClientApp.Common, Version=9.1.0.0, Culture=neutral, PublicKeyToken=c583c5a4dddb9a96"
initializeData="@(LocalApplicationData)\ClientApp\cpwin.log" />
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
Here's what I tried (added another switch and another listener. EventLog gets written if I set its switch to Verbose, but nothing gets ever written when set to Error (even when errors occur):
<system.diagnostics>
<switches>
<add name="Default" value="Verbose"/>
<add name="EventLog" value="Error"/>
</switches>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="CPLog"
type="ClientApp.Common.Logging.MultiProcessFileTraceListener, ClientApp.Common, Version=9.1.0.0, Culture=neutral, PublicKeyToken=c583c5a4dddb9a96"
initializeData="@(LocalApplicationData)\ClientApp\cpwin.log" />
<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="Client Info" />
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
How could I accomplish this?