Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to record log info to flat file + Event Log
    primarykey
    data
    text
    <p>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.</p> <p>Here's the original .config file. It logs verbosely to a .log file:</p> <pre><code>&lt;system.diagnostics&gt; &lt;switches&gt; &lt;add name="Default" value="Verbose"/&gt; &lt;/switches&gt; &lt;trace autoflush="true" indentsize="4"&gt; &lt;listeners&gt; &lt;add name="CPLog" type="ClientApp.Common.Logging.MultiProcessFileTraceListener, ClientApp.Common, Version=9.1.0.0, Culture=neutral, PublicKeyToken=c583c5a4dddb9a96" initializeData="@(LocalApplicationData)\ClientApp\cpwin.log" /&gt; &lt;remove name="Default" /&gt; &lt;/listeners&gt; &lt;/trace&gt; &lt;/system.diagnostics&gt; </code></pre> <p>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):</p> <pre><code>&lt;system.diagnostics&gt; &lt;switches&gt; &lt;add name="Default" value="Verbose"/&gt; &lt;add name="EventLog" value="Error"/&gt; &lt;/switches&gt; &lt;trace autoflush="true" indentsize="4"&gt; &lt;listeners&gt; &lt;add name="CPLog" type="ClientApp.Common.Logging.MultiProcessFileTraceListener, ClientApp.Common, Version=9.1.0.0, Culture=neutral, PublicKeyToken=c583c5a4dddb9a96" initializeData="@(LocalApplicationData)\ClientApp\cpwin.log" /&gt; &lt;add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="Client Info" /&gt; &lt;remove name="Default" /&gt; &lt;/listeners&gt; &lt;/trace&gt; &lt;/system.diagnostics&gt; </code></pre> <p>How could I accomplish this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload