title: Security Issues Writing to Event Log with My.Application.Log.WriteException
body: <p>I'm handling the Application.UnhandledException event in a WinForms app and need to log exceptions caught there. My app.config is set up to log exceptions to a FileLog and an EventLog.</p>
  
  <p>The problem is that when running as a non-admin user, the EventLog cannot be written to because of a SecurityException - I get the message "The source was not found, but some or all event logs could not be searched."</p>
  
  <p>I understand why - the user does not have permission to create the EventLog source, but the question is how should this source be created? As I see it, I could either:</p>
  
  <p>1) Create the EventLog source with my installer, as this is running as admin. How to do this?</p>
  
  <p>2) Create from within my app, by somehow elevating permissions? But this would give the UAC prompt on Vista.</p>
  
  <p>What's the best practice for creating a Windows Application EventLog source on a client machine?</p>
  
  <p>thanks</p>