Debugging techniques, Debugging objective-c, Debugging mixed applications – Apple WebObjects 3.5 User Manual

Page 58: Writing debug messages

Advertising
background image

Chapter 4

Debugging a WebObjects Application

58

executable in the launch panel. Output from the debugging methods appears in
the launch panel.

Debugging Objective-C

If all or part of your application is written in Objective-C, you can use the

gdb

debugger in Project Builder. For more information on debugging an Objective-
C application with Project Builder, see Project Builder’s online help.

If your application contains WebScript code as well as Objective-C code, you
debug the WebScript portion using

logWithFormat:

and WOApplication trace

statements as described in “Debugging Techniques” (page 58).

Debugging Mixed Applications

When you build a WebObjects application project, the result is a

.woa

file

package inside of the project directory. You may notice that this file package
contains all of the application’s components (including scripted components),
and all other resources need to run the application, as well as the application
executable itself.

When you’re debugging an application, the executable uses the components
from the project directory instead of those in the

.woa

package, so you can safely

ignore the components placed inside of the

.woa

package. When you need to

make a change, change the component in the project directory. When you run
an application, it checks to see if its

.woa

package is inside of a project directory

(that is, a directory that contains a file named

PB.project

). If it is, the application

takes its scripted components from the project directory. This way, you can
make any necessary changes to your scripts in Project Builder, and (once you
have saved the scripts) your application automatically picks up your changes
without your having to rebuild.

Debugging Techniques

To debug WebScript and Java code, you rely primarily on log messages and trace
statements that write to standard output. This section describes the statements
you can include in your code to help you debug.

Writing Debug Messages

The method

logWithFormat:

(in Java,

logString

) writes a formatted string to standard

error (

stderr

).

Advertising