TRACELOG for PowerBuilder application
What is a tracelog?
The tracelog (n_trace) is a Powerbuilder object that allows:
- Catch all sql errors (with object name and line information)
- Catch print messages from server
- Organize debug logging for your applications (online, text file, html)
Restrictions
Today only Sybase ASE and Microsoft SQL servers are supported.
Download
tracelog.zip ansi and unicode versions of the n_trace object, and tracelog.dll
test.sra an example application object that shows usage of the n_trace
test.zip workspace + target + PBL with test.sra example created with PowerBuilder9
n_trace object prototype
- of_setTitle (string s)
Sets the title of the Tracelog window, and the tooltip for the icon in the tray.
returns none.
- of_log ( string as_object, string as_info, long al_mask)
Adds the message into a log.
as_object the object name that sends a message.
as_info the message test to add into the log.
al_mask the message type defined through msg_xxx members of n_trace.
- of_log (powerobject apo_object, string as_info, long al_mask)
The version of the function with first parameter defined not as object name but as object itself.
- of_dbHandlerSet (transaction atr)
Installs the message/error handler for Sybase ASE (SYC) or Microsoft SQL (MSS) servers.
If you want to install message handler, you should do it after "connect" command.
If the message came from the server it will be automatically added into the tracelog with "sql error" or "sql print" mask (type).
- of_dbHandlerDel (transaction atr)
Removes previously installed message/error handler.
Must be called before "disconnect" command.
- of_debug (powerobject obj, string s)
identical to call: n_trace.of_log( obj, s, n_trace.msg_debug )
- of_info (powerobject obj, string s)
identical to call: n_trace.of_log( obj, s, n_trace.msg_info )
- INSTANCE VARIABLES:
privatewrite long msg_syserr = 1 //sys error
privatewrite long msg_sqlerr = 2 //sql error
privatewrite long msg_sqlprint = 4 //sql print
privatewrite long msg_sqlpreview = 8 //sql preview
privatewrite long msg_procreturn = 16 //proc return
privatewrite long msg_debug = 32 //debug
privatewrite long msg_info = 64 //info
privatewrite long msg_create = 128 //create
privatewrite long msg_destroy = 256 //destroy
privatewrite long msg_open = 512 //open
privatewrite long msg_close = 1024 //close
privatewrite long msg_click = 2048 //click
privatewrite long msg_dblclick = 4096 //dblclick
privatewrite long msg_keydown = 8192 //keydown
privatewrite long msg_keyup = 16384 //keyup
privatewrite long msg_message = 32768 //message
privatewrite long msg_datawindow = 65536 //datawindow
Screenshots
To access the log you need just click on the icon in the tray:

You will see the log:

At any time during your application execution the developer able to
change the mask (types) of messages that he want to see in the log:

All messages from the start of application will be
redisplayed according to the selected mask.
To see the full message text, doubleclick on it or press "Enter":

The log window is enabled; even you have a PowerBuilder
system error or application crash. Of cause, If PB application was terminated,
then tracelog will be terminated also, because it is the same process.
Trace Log Configuration
All configurations are stored in tracelog.ini file:
[options]
;create or not the tracelog window and tray icon
;maybe the final application user should not see this log in his tray
debug=Y
;this value you can set from the interface (tracelog window filter)
mask.debug=-1
;store info into text file with the specified mask:
;0 means do not create file
;log file will be created in "%USERPROFILE%\tracelog" directory
mask.file=0
[tracelog.maskinfo]
;here you can define mask information
;format:
; mask = X Display info
; The "Display info" is limited to 29 symbols
; and X defines icon :
; e error icon
; i information
; w warning
1 = e sys error
2 = e sql error
4 = i sql print
8 = i sql preview
16 = i proc return
32 = w debug
64 = i info
128 = i create
256 = i destroy
512 = i open
1024 = i close
2048 = i click
4096 = i dblclick
8192 = i keydown
16384 = i keyup
32768 = w message
65536 = i datawindow
131072= i dragdrop
;below you will find tracelog windows placement
;automatically stored on application close
[tracelog.w_main]
x=-2
y=558
w=1027
h=183
[tracelog.listview]
col0=90
col1=90
col2=232
col3=588
[tracelog.w_detail]
x=0
y=0
w=564
h=454
top |
control panel