13 August 2012

Siebel: Trace Only When Needed

"Trace" statements in Siebel script 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. This can be easily accomplished using VB Script (not Siebel, stand-alone).

1. 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
2. Save the file and close it (assume the file is called "COGSiebelLog.vbs")
3. Open Siebel client as always, navigate to the specific screen of interest
4. Double click on the VBS file to run the script
5. 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).

1 comment:

Anonymous said...

It doesn't work for web clients. The error I got was: "ActiveX component can't create object: "TWSiebel.SiebelWebApplication, 1", Code 800A01AD.
Any suggestions to amend this error? Would appreciate it.

Post a Comment