The following code writes a message to the windows event application log under the existing event source “BizTalk Server”.
The code above is normally placed inside an Expression shape in the orchestration as shown as “Write eventlog”
However if you require to write to your own defined event source, you must create the key in the registry first under the following path “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\Application”. The BizTalk host account must have read access to the security key and Read/Write access the new event key.
I tend to create a new event source for each application I deploy, so I decided to use a PowerShell script to create the key and set the permissions for each of the environments to save time.
Use the script below and replace the 2 variables values $EventName and $AccountName with the name of your event source and the account of the host instance for the orchestration.
Next open a PowerShell window as “Run as Administrator” and execute the script to create the key and permissions.