ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Test
  • Overview
  • How to?
  • Displaying information
  • Managing the display of debug information
  • Creating a trace file
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
In some cases, running a program or a site with or without the debugger can produce different results.
Indeed, the debugger introduces pauses in the execution of the process during which several tasks are performed by WINDEV.
Therefore, the debugger cannot be used in a procedure called by timer or in the code of a scrollbar.
To debug these applications, you may want to follow the changes of a value, how different procedures are called, etc.
WEBDEV - Browser code This method also allows you to debug the browser code (entered in WLanguage).
This information can be:
  • displayed on the screen,
  • stored in a trace file.
Caution: If the information is displayed on the screen, it must be displayed during the application tests only.
How to?

Displaying information

Two tools can be used to display information:
  • The information boxes: Info WLanguage function. Caution: Displaying an information box is a locking operation.
  • The trace window: WLanguage Trace function.
The trace window appears in the upper-left corner of the screen, without interrupting the program. If can also be displayed it in the interface via the "Debugger trace" pane.
WEBDEV - Browser code The trace window displayed from a Browser code is different from the one displayed from a Server code. Two trace windows can be displayed at the same time. The information found in the "Browser" trace window is not displayed in the "Debugger trace" pane.

Managing the display of debug information

Displaying the debug information on the screen is useful in test mode only.
Any unsuitable display must be removed before distributing an application.
To avoid any oversight, it is recommended to manage how the debug information is displayed via a global procedure. For example:
PROCÉDURE MyTrace(StringToTrace)
IF InTestMode() = True THEN
Trace(StringToTrace)
END
In this code, depending on the result of InTestMode, the trace window appears when testing the application or site
Such procedure allows you to leave the call to the trace windows in the application code without any risk of displaying it on the end-user computers.
The call to this trace procedure is identical to the use of Trace:
MyTrace("Customer: " + Customer.CustomerNum)

Creating a trace file

During long processes (batch processes, ...), to check how the program is running, you must keep a physical trace of the processes performed (a text file for example).
The following procedure is used to manage the trace display:
  • On the screen (/DEBUG parameter in command line).
  • In a text file (default mode).
PROCÉDURE MyTrace(StringToTrace)
FilePath is string
FilePath = fDataDirUser() + ProjectInfo(piProjectName) + ".txt"
FileNum is int
DebugMode is boolean = False
IF Position(CommandLine(), "/DEBUG") > 0 THEN
DebugMode = True
END
IF DebugMode = True THEN
Trace(StringToTrace)
ELSE
FileNum = fOpen(FilePath, foCreateIfNotExist + foWrite + foAdd)
IF FileNum <> -1 THEN
DateTimeTrace is DateTime = SysDateTime()
DateTrace is string = MyDate..Date
TimeTrace is Time = MyDate..Time
fWriteLine(FileNum, DateToString(DateTrace) + ...
" - " + TimeToString(TimeTrace))
fWriteLine(FileNum, StringToTrace)
fWriteLine(FileNum, " ")
fClose(FileNum)
END
END
Remarks:
  • The trace file is created by default in the user data directory. This file is named like the project. This file contains the information to trace during the program execution. The information is completed by the date and time of each "Trace". This allows you to detect a potential problem during the process.
  • Example of trace file content:
    01/12/2001 - 10:53:25:20
    Customer name: Martin
    01/12/2001 - 10:53:25:26
    Customer name: Mirva
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help