Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Ecrire un message de ‘log’

Modifier,ou,créer,une,source,d'événement
{filelink=15671}

  using System;
  using System.Resources;
  using System.Collections;
  using Microsoft.Win32;
 
  // Exemple des événements 'Log'
  using System.Diagnostics;
  class ExempleEventLog
  {
    static void Main(string[] args)
    {
      EventLog log = new EventLog();
      log.Log = "Application";
      log.Source = "Mes Exemples";
      log.WriteEntry("Message envoyé par l'application");
 
      // Display the first 5 entries in the Application log.
      for(int i = 0; i < 5; i++)
      {
        Console.WriteLine("Message: " + log.Entries[i].Message + " "
            +   "Box: " + log.Entries[i].MachineName + " "
            +   "App: " + log.Entries[i].Source + " "
            +   "Heures: " + log.Entries[i].TimeWritten,
                 "Entrée Log pour l'applicaion");
      }
      log.Close();
    }
  }

No comments yet.

Leave a Comment