using System;
using System.Resources;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Resources;
using Microsoft.Win32;
// For event log.
using System.Diagnostics;
class Test
{
static void Main(string[] args)
{
EventLog log = new EventLog();
log.Log = "Application";
log.Source = "www.java2java.com";
log.WriteEntry("message from my own exa,ple...");
// Display the first 5 entries in the Application log.
for(int i = 0; i < 5; i++)
{
Console.WriteLine("Message: " + log.Entries[i].Message + "\n" +
"Box: " + log.Entries[i].MachineName + "\n" +
"App: " + log.Entries[i].Source + "\n" +
"Time entered: " + log.Entries[i].TimeWritten,
"Application Log entry:");
}
log.Close();
}
}
|