Trace On-The-Go for Siebel Scripts
“Trace” statements in Siebel eScript (or even in Siebel VB for that matter) provides a good way to debug and know what indeed is going on in the background. It is common enough to use the following statements to do debugging in scripts:
TheApplication().TraceOn("c:\trace.txt", "Allocation", "All"); ... ... TheApplication().Trace("Committed to the change " + rowId); ... TheApplication().TraceOff();
While this is easy enough, an additional flexibility to trace only when required works out better. The on-the-go trace functionality can be easily accomplished using VB Script (not to be confused with Siebel VB).
- Open Notepad and type the following lines
'Reference SiebelApplication object set oSiebelApp = CreateObject("TWSiebel.SiebelWebApplication.1")'Start tracing with appropriate parameters. Uncomment one of the options oSiebelApp.TraceOn "C:\sbl-trace.txt", "Allocation", "all" 'oSiebelApp.TraceOn "C:\sbl-sql-trace.txt", "sql", "all"'Continue tracing until stopped set wshell = CreateObject("Wscript.Shell") wshell.Run ("%comspec% /c title COGSiebelLog & echo Tracing in Siebel is currently on. & pause"), 1, true'Stop trace and destroy object oSiebelApp.TraceOff set wshell = Nothing
- Save the file and close it (assume the file is called “COGSiebelLog.vbs”)
- Open Siebel client as always, navigate to the specific screen of interest
- Double click on the VBS file to run the script
- Perform the transaction that needs to be traced, hit ‘Enter’ in the command prompt of the running script after the transaction
You will find that the trace happens only when the VB script is running. You would still need to have ‘Trace’ statements in the script for any custom tracing though. A similar approach can be applied for SQL tracing as well (refer to the commented line in the above script).