Skip to content

Instantly share code, notes, and snippets.

@luisdeol
Created May 28, 2020 11:23
Show Gist options
  • Save luisdeol/f22d3625ae40442c04a8aef9c52377b3 to your computer and use it in GitHub Desktop.
Save luisdeol/f22d3625ae40442c04a8aef9c52377b3 to your computer and use it in GitHub Desktop.
3.5: Writing to ETW
using System;
using System.Diagnostics;
namespace _35_ApplicationDiagnostics
{
class Program
{
static void Main(string[] args)
{
var source = "35_ApplicationDiagnostics";
using (var eventLog = new EventLog("Aplicativo"))
{
if (!EventLog.SourceExists(source))
{
EventLog.CreateEventSource(source, "LogApp");
}
eventLog.Source = source;
eventLog.EnableRaisingEvents = true;
eventLog.EndInit();
eventLog.WriteEntry("Just testing EventDe Log writing.", EventLogEntryType.Information);
}
Console.Read();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment