Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing EventLog in ClickOnce application
    primarykey
    data
    text
    <p>I've got a library that I use across multiple ClickOnce applications. In the event of an error in this library I would like to write the error to the windows <code>EventLog</code>. </p> <p>I found a <a href="http://support.microsoft.com/kb/307024" rel="nofollow noreferrer">KB article</a> on how but it seems that this requires administrator permissions to search the for the source. Specifically it chokes when trying to search the <code>Security</code> event log.</p> <p>Is there anyway to work around this and write to the event log in a ClickOnce application? I saw one person <a href="https://stackoverflow.com/q/7024260/1111886">trying to write to a known source</a>, but they didn't seem to be able to find a source that was consistently available.</p> <p><strong>EDIT:</strong></p> <p>Based on answers here I create an program that's included with my application that I can run on the first run to set up the event source that can get admin privileges. However once the source is created it seems I still cannot write to it.</p> <pre><code> /// &lt;summary&gt; /// The main entry point for the application. /// &lt;/summary&gt; [STAThread] static void Main() { if (!EventLog.SourceExists("ATE")) { EventLog.CreateEventSource("ATE", "Application"); } } </code></pre> <p>Is properly creates a source (which is equivalent to the registry edit provided by Yannick Blondeau). When I write to the source in my non-elevated application I receive an new error, but it still doesn't work. The new error is:</p> <p><code>Cannot open log for source 'ATE'. You may not have write access.</code></p> <p><strong>EDIT 2:</strong></p> <p>I've now been trying to get it to work through registry edits on the <a href="http://msdn.microsoft.com/en-us/library/aa363648.aspx" rel="nofollow noreferrer">CustomSD key</a>. I tried adding (A;;0x7;;;AU) to give authenticated users full access but it didn't seem to have any effect.</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.
 

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