Wednesday, 12 August 2015

strating a trace from x++ code

Start a trace through code instrumentation
You can use the xClassTrace class from the Tracing Cockpit to start and stop a trace. To trace the Sales
Form letter logic, see the following sample in \Classes\SalesFormLetter:
// Add
xClassTrace xCt = new xClassTrace();
// to the variable declaration.
// …code…
if (salesFormLetter.prompt())
{
xClassTrace::start("c:\\temp\\test1.etl");
xClassTrace::logMessage("test1");
xCt.beginMarker("marker"); // Add markers at certain points of a trace to
// increase trace readability. You can add
// multiple markers per trace.
salesFormLetter.run();
xCt.endMarker("marker");
xClassTrace::stop();
outputContract = salesFormLetter.getOutputContract();
numberOfRecords = outputContract.parmNumberOfOrdersPosted();
}
// …code…
In the call to xClassTrace::start, you can use multiple parameters to specify the events to trace or
whether you want to use circular logging, among other things. To find out which keyword equals
which parameter, put a breakpoint in the class SysTraceCockpitcontroller\startTracing and start a trace
from the Tracing Cockpit with various events selected

No comments:

Post a Comment

intercompany PO multiple product receipt by x++

public void processStampICPO(PackingSlipId _deliveryNote,                             Transdate _deliverydate,                             ...