{"id":649,"date":"2010-07-13T14:15:20","date_gmt":"2010-07-13T08:45:20","guid":{"rendered":"http:\/\/JitendraZaa.com\/blog\/?p=649"},"modified":"2010-07-13T14:15:20","modified_gmt":"2010-07-13T08:45:20","slug":"log-event-in-windows-operating-system-using-c","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/microsoft\/csharp\/log-event-in-windows-operating-system-using-c\/","title":{"rendered":"Log Event in Windows Operating System Using C#"},"content":{"rendered":"<p>Below is the Utility function used to log the message in Microsoft Windows Operating Systems.<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\nclass Program\n    {\n        static void Main(string&#x5B;] args)\n        {\n            LogMessage(&quot;ShivaSoftBlog - Error Message&quot;, EventLogEntryType.Error);\n            LogMessage(&quot;ShivaSoftBlog - Failure Audit Message&quot;, EventLogEntryType.FailureAudit);\n            LogMessage(&quot;ShivaSoftBlog - Information Message&quot;, EventLogEntryType.Information);\n            LogMessage(&quot;ShivaSoftBlog - Success Audit Message&quot;, EventLogEntryType.SuccessAudit);\n            LogMessage(&quot;ShivaSoftBlog - Warning Message&quot;, EventLogEntryType.Warning);\n            Console.WriteLine(&quot;LOg Success&quot;);\n            Console.Read();\n        }\n\n        private static void LogMessage(string message, EventLogEntryType logType)\n        {\n            if (!EventLog.SourceExists(&quot;ShivaSoftBlog&quot;))\n                EventLog.CreateEventSource(&quot;ShivaSoftBlog&quot;, &quot;Application&quot;);\n\n            EventLog ncsLog = new EventLog();\n            ncsLog.Source = &quot;ShivaSoftBlog&quot;;\n            ncsLog.WriteEntry(message, logType);\n\n        }\n    }\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Tutorial on Logging Message in EventLog of Microsoft Windows.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"jz_research_post":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[22],"tags":[142],"class_list":["post-649","post","type-post","status-publish","format-standard","hentry","category-csharp","tag-logging"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1917,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/a-simple-program-to-send-email-in-java\/","url_meta":{"origin":649,"position":0},"title":"A simple program to send email in JAVA","author":"Jitendra","date":"April 6, 2011","format":false,"excerpt":"A Simple SMTP Email Program in JAVA","rel":"","context":"In &quot;JAVA&quot;","block_context":{"text":"JAVA","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1643,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/jsp\/servlet-hibernate-jquery-and-ajax-based-google-like-chat\/","url_meta":{"origin":649,"position":1},"title":"Servlet, Hibernate, jQuery and Ajax based google like chat","author":"Jitendra","date":"March 14, 2011","format":false,"excerpt":"Servlet, Hibernate, jQuery and Ajax based google like chat with source code","rel":"","context":"In &quot;Hibernate&quot;","block_context":{"text":"Hibernate","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/hibernate\/"},"img":{"alt_text":"Servlet, Hibernate, jQuery and Ajax based google like chat","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2011\/03\/Servlet-Hibernate-jQuery-and-Ajax-based-google-like-chat.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":258,"url":"https:\/\/www.jitendrazaa.com\/blog\/microsoft\/net\/tracing-asp-net-website\/","url_meta":{"origin":649,"position":2},"title":"Tracing ASP.NET Website","author":"Jitendra","date":"June 28, 2010","format":false,"excerpt":"Demonstrates that how to Trace ASP.NET web applications","rel":"","context":"In &quot;ASP.NET&quot;","block_context":{"text":"ASP.NET","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/microsoft\/net\/"},"img":{"alt_text":"ASP.NET Tracing Output","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2010\/05\/Tracing-FirstPage1.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1933,"url":"https:\/\/www.jitendrazaa.com\/blog\/microsoft\/csharp\/virtual-override-and-new-keyword-in-c\/","url_meta":{"origin":649,"position":3},"title":"Virtual, Override and new Keyword in C#","author":"Jitendra","date":"April 7, 2011","format":false,"excerpt":"Virtual, Override and new Keyword : Polymorphism , Method Hiding and Overriding in C#","rel":"","context":"In &quot;c#&quot;","block_context":{"text":"c#","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/microsoft\/csharp\/"},"img":{"alt_text":"Multilevel Inheritance","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2011\/04\/Multilevel-Inheritance.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2691,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/create-soap-message-using-java\/","url_meta":{"origin":649,"position":4},"title":"Create SOAP message using Java","author":"Jitendra","date":"February 2, 2012","format":false,"excerpt":"Step by Step Example of creating SOAP Message using core Java API","rel":"","context":"In &quot;JAVA&quot;","block_context":{"text":"JAVA","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/"},"img":{"alt_text":"SOAP Message Format for Web Services","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/02\/SOAP.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1029,"url":"https:\/\/www.jitendrazaa.com\/blog\/microsoft\/logging-made-easy-in-net-log-4-net\/","url_meta":{"origin":649,"position":5},"title":"Logging made easy in .NET &#8211; log 4 net","author":"Jitendra","date":"September 30, 2010","format":false,"excerpt":"How to use the log 4 net in .Net application. Example, demonstration and sourcecode","rel":"","context":"In &quot;c#&quot;","block_context":{"text":"c#","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/microsoft\/csharp\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/649","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/comments?post=649"}],"version-history":[{"count":0,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/649\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=649"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=649"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=649"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}