Hello Everyone
Have you ever guessed what are the input and output property sets and methods called while a vanilla business is executing....
well here is the step to log them in a readable and logical way...
for eg lets take the BS: Search External Service
Enter the following lines of code in the declaration section.....
/*----------------------------This is the Declaration Section --------------------------------------------------*/
var OutPutFileName = 'C:\\SearchExternal_Dump.txt'; //Your fav Location and name:)
var IndentAmount = 2; // Indent child prop sets listing this many spaces // to the right for each level down for readability
Now comes our 2 handy function
1.LogMe ( writes down every input provided to a text file path declared in declaration)
2.DumpPropSets(Dumps the property sets)
Code of both these functions follows
1.LogMe Function
// Writes what is feeded.
function LogMe(LogThis)
{
var MyFile = Clib.fopen(OutPutFileName, 'at');
var sTime = Clib.ctime(Clib.time());
sTime = sTime.replace('\n',' '); // Remove trailing Newline.
Clib.fputs(sTime + ': ' + LogThis + '\n', MyFile);
Clib.fclose(MyFile);
}
2.DumpPropSet Function
/*------Premjit Vidyadharan:Function to collect property sets and feed to LogMe for printing-*/
/*--------------------Print out the contents of a property set--------------------------------*/
function DumpPropSet(Inputs)
{
PSDepth++;
var InpValue;
var InpType;
var InpChildCount;
var inprop;
var inpropval;
var inpropcnt;
var BlankLine = ' ';
/*--------------------------Build a string to indent the Listing------------------*/
var IndentSpaces = ''; // [Number of spaces to indent to]
for (var SpaceCount = 0; SpaceCount < IndentAmount * PSDepth; SpaceCount++)
{
IndentSpaces = IndentSpaces + ' ';
}
var IndentLevel = ToString(PSDepth);
if (PSDepth < 10)
{
IndentLevel = '0' + IndentLevel;
}
// Indent by a number of indents, then level number as nn, then two spaces
var Indent = IndentSpaces + IndentLevel + ' ';
LogMe(BlankLine);
LogMe(BlankLine);
LogMe(Indent + '---- Starting a new property set ----');
LogMe(BlankLine);
// Now do main value and type
InpValue = Inputs.GetValue();
InpType = Inputs.GetType();
InpChildCount = Inputs.GetChildCount();
LogMe(Indent + 'Value is ........ : "' + InpValue + '"');
LogMe(Indent + 'Type is ........ : "' + InpType + '"');
LogMe(Indent + 'Child count ..... : ' + ToString(InpChildCount));
// Dump the properties of this property set
var PropCounter = 0;
inprop = Inputs.GetFirstProperty();
while (inprop != "")
{
PropCounter++;
inpropval = Inputs.GetProperty(inprop);
LogMe(BlankLine);
var PropCountStr = ToString(PropCounter);
if (PropCounter < 10)
{
PropCountStr = '0' + PropCountStr;
}
LogMe(Indent + 'Property ' + PropCountStr + ' name : "' + inprop + '"');
LogMe(Indent + 'Property ' + PropCountStr + ' value : "' + inpropval + '"');
inprop = Inputs.GetNextProperty();
}//while (inprop != "") ends
/*-----------------------------------Dump the children of this PropertySet-----------------------------*/
if (InpChildCount == 0)
{
LogMe(BlankLine);
LogMe(Indent + '(No children exist below this property set.)');
}
else
{
for (var ChildNumber = 0; ChildNumber < InpChildCount; ChildNumber++)
{
LogMe(BlankLine);
LogMe(Indent + 'Child Property Set ' + ToNumber(ChildNumber + 1) + ' of ' + ToNumber(InpChildCount) + ' follows below.');
LogMe(Indent + 'This child is on level ' + ToNumber(PSDepth));
// Recursive call for children, grandchildren, etc.
DumpPropSet(Inputs.GetChild(ChildNumber));
}
}
PSDepth--; // We are about to pop up a level
}
Now Call this functon at the evnt of your choice
eg given below
function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
{
LogMe('---- Method Called PreInvoke ----'+ MethodName);
LogMe('---- Method Called PreInvoke-----INPUTS ----'+ MethodName);
LogMe(Inputs);
LogMe('---- Method Called PreInvoke----- OUTPUTS ---'+ MethodName);
LogMe(Outputs);
LogMe('---- PreInvoke Ends Here---------------------'+ MethodName);
return (ContinueOperation);
}
Below is the result which we get....A long story to read for the debuggers ot there
Wed Feb 22 05:12:57 2012 : ---- Method Called PreInvoke ----GetParams
Wed Feb 22 05:12:57 2012 : ---- Method Called PreInvoke-----INPUTS ----GetParams
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- Method Called PreInvoke----- OUTPUTS ---GetParams
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- PreInvoke Ends Here---------------------GetParams
Wed Feb 22 05:12:57 2012 : ---- Method Called Invoke ----GetParams
Wed Feb 22 05:12:57 2012 : ---- Method Called Invoke INPUTS ----------------------GetParams
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- Method Called Invoke OUTPUTS ---------------------GetParams
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- Invoke Ends Here----------------------------------GetParams
Wed Feb 22 05:12:57 2012 : ---- Method Called PreInvoke ----SetSamePage
Wed Feb 22 05:12:57 2012 : ---- Method Called PreInvoke-----INPUTS ----SetSamePage
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- Method Called PreInvoke----- OUTPUTS ---SetSamePage
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- PreInvoke Ends Here---------------------SetSamePage
Wed Feb 22 05:12:57 2012 : ---- Method Called Invoke ----SetSamePage
Wed Feb 22 05:12:57 2012 : ---- Method Called Invoke INPUTS ----------------------SetSamePage
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- Method Called Invoke OUTPUTS ---------------------SetSamePage
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- Invoke Ends Here----------------------------------SetSamePage
Wed Feb 22 05:12:57 2012 : ---- Method Called PreInvoke ----FindOnly
Wed Feb 22 05:12:57 2012 : ---- Method Called PreInvoke-----INPUTS ----FindOnly
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- Method Called PreInvoke----- OUTPUTS ---FindOnly
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- PreInvoke Ends Here---------------------FindOnly
Wed Feb 22 05:12:57 2012 : ---- Method Called Invoke ----FindOnly
Wed Feb 22 05:12:57 2012 : ---- Method Called Invoke INPUTS ----------------------FindOnly
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- Method Called Invoke OUTPUTS ---------------------FindOnly
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- Invoke Ends Here----------------------------------FindOnly
Be sure to remove the code when u are done with the debugging.........
Enjoy!!!!!!!!!!!!!!!!
Have you ever guessed what are the input and output property sets and methods called while a vanilla business is executing....
well here is the step to log them in a readable and logical way...
for eg lets take the BS: Search External Service
Enter the following lines of code in the declaration section.....
/*----------------------------This is the Declaration Section --------------------------------------------------*/
var OutPutFileName = 'C:\\SearchExternal_Dump.txt'; //Your fav Location and name:)
var IndentAmount = 2; // Indent child prop sets listing this many spaces // to the right for each level down for readability
Now comes our 2 handy function
1.LogMe ( writes down every input provided to a text file path declared in declaration)
2.DumpPropSets(Dumps the property sets)
Code of both these functions follows
1.LogMe Function
// Writes what is feeded.
function LogMe(LogThis)
{
var MyFile = Clib.fopen(OutPutFileName, 'at');
var sTime = Clib.ctime(Clib.time());
sTime = sTime.replace('\n',' '); // Remove trailing Newline.
Clib.fputs(sTime + ': ' + LogThis + '\n', MyFile);
Clib.fclose(MyFile);
}
2.DumpPropSet Function
/*------Premjit Vidyadharan:Function to collect property sets and feed to LogMe for printing-*/
/*--------------------Print out the contents of a property set--------------------------------*/
function DumpPropSet(Inputs)
{
PSDepth++;
var InpValue;
var InpType;
var InpChildCount;
var inprop;
var inpropval;
var inpropcnt;
var BlankLine = ' ';
/*--------------------------Build a string to indent the Listing------------------*/
var IndentSpaces = ''; // [Number of spaces to indent to]
for (var SpaceCount = 0; SpaceCount < IndentAmount * PSDepth; SpaceCount++)
{
IndentSpaces = IndentSpaces + ' ';
}
var IndentLevel = ToString(PSDepth);
if (PSDepth < 10)
{
IndentLevel = '0' + IndentLevel;
}
// Indent by a number of indents, then level number as nn, then two spaces
var Indent = IndentSpaces + IndentLevel + ' ';
LogMe(BlankLine);
LogMe(BlankLine);
LogMe(Indent + '---- Starting a new property set ----');
LogMe(BlankLine);
// Now do main value and type
InpValue = Inputs.GetValue();
InpType = Inputs.GetType();
InpChildCount = Inputs.GetChildCount();
LogMe(Indent + 'Value is ........ : "' + InpValue + '"');
LogMe(Indent + 'Type is ........ : "' + InpType + '"');
LogMe(Indent + 'Child count ..... : ' + ToString(InpChildCount));
// Dump the properties of this property set
var PropCounter = 0;
inprop = Inputs.GetFirstProperty();
while (inprop != "")
{
PropCounter++;
inpropval = Inputs.GetProperty(inprop);
LogMe(BlankLine);
var PropCountStr = ToString(PropCounter);
if (PropCounter < 10)
{
PropCountStr = '0' + PropCountStr;
}
LogMe(Indent + 'Property ' + PropCountStr + ' name : "' + inprop + '"');
LogMe(Indent + 'Property ' + PropCountStr + ' value : "' + inpropval + '"');
inprop = Inputs.GetNextProperty();
}//while (inprop != "") ends
/*-----------------------------------Dump the children of this PropertySet-----------------------------*/
if (InpChildCount == 0)
{
LogMe(BlankLine);
LogMe(Indent + '(No children exist below this property set.)');
}
else
{
for (var ChildNumber = 0; ChildNumber < InpChildCount; ChildNumber++)
{
LogMe(BlankLine);
LogMe(Indent + 'Child Property Set ' + ToNumber(ChildNumber + 1) + ' of ' + ToNumber(InpChildCount) + ' follows below.');
LogMe(Indent + 'This child is on level ' + ToNumber(PSDepth));
// Recursive call for children, grandchildren, etc.
DumpPropSet(Inputs.GetChild(ChildNumber));
}
}
PSDepth--; // We are about to pop up a level
}
Now Call this functon at the evnt of your choice
eg given below
function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
{
LogMe('---- Method Called PreInvoke ----'+ MethodName);
LogMe('---- Method Called PreInvoke-----INPUTS ----'+ MethodName);
LogMe(Inputs);
LogMe('---- Method Called PreInvoke----- OUTPUTS ---'+ MethodName);
LogMe(Outputs);
LogMe('---- PreInvoke Ends Here---------------------'+ MethodName);
return (ContinueOperation);
}
Below is the result which we get....A long story to read for the debuggers ot there
Wed Feb 22 05:12:57 2012 : ---- Method Called PreInvoke ----GetParams
Wed Feb 22 05:12:57 2012 : ---- Method Called PreInvoke-----INPUTS ----GetParams
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- Method Called PreInvoke----- OUTPUTS ---GetParams
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- PreInvoke Ends Here---------------------GetParams
Wed Feb 22 05:12:57 2012 : ---- Method Called Invoke ----GetParams
Wed Feb 22 05:12:57 2012 : ---- Method Called Invoke INPUTS ----------------------GetParams
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- Method Called Invoke OUTPUTS ---------------------GetParams
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- Invoke Ends Here----------------------------------GetParams
Wed Feb 22 05:12:57 2012 : ---- Method Called PreInvoke ----SetSamePage
Wed Feb 22 05:12:57 2012 : ---- Method Called PreInvoke-----INPUTS ----SetSamePage
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- Method Called PreInvoke----- OUTPUTS ---SetSamePage
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- PreInvoke Ends Here---------------------SetSamePage
Wed Feb 22 05:12:57 2012 : ---- Method Called Invoke ----SetSamePage
Wed Feb 22 05:12:57 2012 : ---- Method Called Invoke INPUTS ----------------------SetSamePage
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- Method Called Invoke OUTPUTS ---------------------SetSamePage
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- Invoke Ends Here----------------------------------SetSamePage
Wed Feb 22 05:12:57 2012 : ---- Method Called PreInvoke ----FindOnly
Wed Feb 22 05:12:57 2012 : ---- Method Called PreInvoke-----INPUTS ----FindOnly
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- Method Called PreInvoke----- OUTPUTS ---FindOnly
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- PreInvoke Ends Here---------------------FindOnly
Wed Feb 22 05:12:57 2012 : ---- Method Called Invoke ----FindOnly
Wed Feb 22 05:12:57 2012 : ---- Method Called Invoke INPUTS ----------------------FindOnly
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- Method Called Invoke OUTPUTS ---------------------FindOnly
Wed Feb 22 05:12:57 2012 : PropertySet [ ]
Wed Feb 22 05:12:57 2012 : ---- Invoke Ends Here----------------------------------FindOnly
Be sure to remove the code when u are done with the debugging.........
Enjoy!!!!!!!!!!!!!!!!