Advertisement
Guest User

Untitled

a guest
May 27th, 2015
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. using System;
  2. using System.Diagnostics;
  3.  
  4. namespace LoggingTest
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. string sSource;
  11. string sLog;
  12. string sEvent;
  13.  
  14. sSource = "dotNET Sample App";
  15. sLog = "Application";
  16. sEvent = "Sample Event,What's the fuck!";
  17.  
  18. if (!EventLog.SourceExists(sSource))
  19. EventLog.CreateEventSource(sSource, sLog);
  20.  
  21. EventLog.WriteEntry(sSource, sEvent);
  22. EventLog.WriteEntry(sSource, sEvent,
  23. EventLogEntryType.Warning, 234);
  24. // and then we can see log in Windows Event Viewer
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement