WebSphere Commerce Developer

Tracing an OpenLaszlo build

A stack trace shows which methods and handlers are called while the application is running.

You can enable the debug console when OpenLaszlo applications are running. When the debug console is enabled, an OpenLaszlo application logs information to the console. For example all warning or error messages, when the application is running, are logged.

The debug console shows all logged messages. Use this information to view the associated stack trace.

To enable tracing, see Building OpenLaszlo applications.

Clicking any warning, error, or debug messages, logged in the debug console, displays extra information including a backtrace. The backtrace shows the method calls that lead to the logged message. In this example, a debug message is printed from Service.lzx line 1165:
Debug trace
When you click the backtrace link, the methods that led to the debug message are printed.

The backtrace option is also available not only for debugging but also for error and warning messages. Click an error message to see the backtrace of what caused the error.

When adding debug messages to your code, use the Debug.debug() method to print messages instead of the Debug.write() method. This method ensures that your messages contain a backtrace. Calls to Debug.debug() can appear inside handlers, methods, and attribute setter methods.