
Untitled
By: a guest on
May 6th, 2012 | syntax:
None | size: 0.59 KB | hits: 13 | expires: Never
using System;
using System.Diagnostics;
using NLog;
namespace EventLogSample
{
class Program
{
static readonly Logger Log = LogManager.GetCurrentClassLogger();
static void Main(string[] args)
{
if (EventLog.SourceExists("TestNLog", ".") == false)
EventLog.CreateEventSource(new EventSourceCreationData("TestNLog", "Application"));
Console.WriteLine("Press enter to finish");
Log.Debug("Testing debug");
EventLog.WriteEntry("TestNLog", "blah");
Console.ReadLine();
}
}
}