How to: Write to the Application Event Log (Visual C#)
This example writes a string to the application event log on the local computer.
System.Diagnostics.EventLog appLog = new System.Diagnostics.EventLog() ; appLog.Source = "This Application's Name"; appLog.WriteEntry("An entry to the Application event log.");
Compiling the Code
Copy the code and paste it into the Main method of a console application.
A SecurityException class can be thrown in partial trust situations.