Wednesday, November 15, 2006

Writing to Eventlog while working with maps using Eventlog Functoid in Biztalk Server 2004

Writing to Eventlog while working with maps using Eventlog Functoid in Biztalk Server 2004

While testing our maps at times when it fails we feel that what could have went wrong and we cant trace it because we don’t know what the output of the functiods are. Normally in a single map we use normally 50-60 functiods.Were do we start debugging our Map. It’s tough when we are under pressure to deliver it on time to debug a map. But it’s a part of our job to make sure that our map is stable. I thought of this functiod while working on a project where in I wanted to see the output of a specific Scripting functiod.
So I just planned to have one which will write to Eventlog any output of data type string. So now what we need to do is just use this functiod to insert into Eventlog.This functiod will return the string after writing it to Eventlog. So just at an overhead of 1 functiod we can test our map to perfection.Just build the solution and drop theEventlogFunctiod.dll in
C:\Program Files\Microsoft BizTalk Server 2004\Developer Tools\Mapper Extensions
And  also GAC it. Then add it in the toolbox and use it in your maps.
Hope it helps you in your project.
The code is given below

using System;
using Microsoft.BizTalk.BaseFunctoids;
using System.Reflection;
using System.Xml;
using System.Diagnostics;
//This Class will write an entry in event log.
//It will take up 1 parameter as input and will output the same parameter after writing it to eventlog
namespace EventlogFunctiods
 public class EventlogFunctoid: BaseFunctoid
  public EventlogFunctoid()
   this.ID = 6464;  
   SetTooltip("Please pass only 1 parameter");
   SetDescription("This Functiod writes the specified parameter to Eventlog.It takes up only 1 paramter");  
    "EventlogFunctiods.EventlogFunctoid", "EventlogFunc");
   this.Category = FunctoidCategory.String;
   this.OutputConnectionType = ConnectionType.AllExceptRecord;
  public string EventlogFunc(string param1)
   return param1;  
If you find it tough to implement....just download the solution which is available at
Any queries or bugs would be appreciated because “To err is human”.

No comments:

Post a Comment