// Arquivo de exemplo: EnableRaisingEvents.cs
// Para compilar utilize: csc EnableRaisingEvents.cs

using System;
using System.Diagnostics;
class Programa
{
	public static void Main()
	{         
		EventLog objLog = new EventLog("Aplicativo", ".", "NomeDaFonte");

		objLog.EntryWritten += new EntryWrittenEventHandler(OnEntryWritten);
		objLog.EnableRaisingEvents = true;
		objLog.WriteEntry("Mensagem de teste", EventLogEntryType.Information);
		Console.Read(); 
	}

	public static void OnEntryWritten(object source, EntryWrittenEventArgs e)
	{
		Console.WriteLine("Evento Executado.");		          
	}
}

