<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://biztalkdev.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results matching tags 'XLANG' and 'C#'</title><link>http://biztalkdev.com/search/SearchResults.aspx?o=DateDescending&amp;tag=XLANG,C%23&amp;orTags=0</link><description>Search results matching tags 'XLANG' and 'C#'</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 (Build: 60809.935)</generator><item><title>Code Snippet: Writing to the EventLog</title><link>http://biztalkdev.com/blogs/paulwu/archive/2007/01/12/Code-Snippet-Writing-to-the-EventLog.aspx</link><pubDate>Sat, 13 Jan 2007 02:04:00 GMT</pubDate><guid isPermaLink="false">b2a643b6-f2ab-4dc9-843d-41843e3c56fa:42</guid><dc:creator>Paul Wu</dc:creator><description>&lt;P&gt;Here is a code snippet for writing information to the EventLog. This code will work in a BizTalk Expression Shape as well as in a .NET application. &lt;/P&gt;
&lt;P&gt;
&lt;TABLE cellPadding=10 bgColor=#eeeedd&gt;

&lt;TR&gt;
&lt;TD&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:black;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;if&lt;/SPAN&gt; (!System.Diagnostics.EventLog.SourceExists(&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:#666666;FONT-FAMILY:Courier New;BACKGROUND-COLOR:#e4e4e4;"&gt;"BizTalkDev.Assembly.Namespace"&lt;/SPAN&gt;))&lt;BR&gt;{&lt;BR&gt;&amp;nbsp; System.Diagnostics.EventLog.CreateEventSource(&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:#666666;FONT-FAMILY:Courier New;BACKGROUND-COLOR:#e4e4e4;"&gt;"BizTalkDev.Assembly.Namespace"&lt;/SPAN&gt;, &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:#666666;FONT-FAMILY:Courier New;BACKGROUND-COLOR:#e4e4e4;"&gt;"Application"&lt;/SPAN&gt;);&lt;BR&gt;}&lt;BR&gt;System.Diagnostics.EventLog.WriteEntry(&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:#666666;FONT-FAMILY:Courier New;BACKGROUND-COLOR:#e4e4e4;"&gt;"BizTalkDev.Assembly.Namespace"&lt;/SPAN&gt;, "Error Message Here", System.Diagnostics.EventLogEntryType.Error);&lt;/SPAN&gt; 
&lt;P&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;
&lt;P&gt;Instead of writing to the "Application" folder, you might consider&amp;nbsp;using your own folder (&lt;EM&gt;replace "Application" with "MyEventLogFolderName"&lt;/EM&gt;) so it will be easier to find your Events.&lt;/P&gt;
&lt;P&gt;If you get an&amp;nbsp;EventLog access error, see &lt;A href="http://biztalkdev.com/blogs/paulwu/archive/2006/11/02/Registry-Access.aspx"&gt;this&lt;/A&gt; post for the&amp;nbsp;correct registry setting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;</description></item></channel></rss>