Recording application statistics, Maintaining a log file – Apple WebObjects 3.5 User Manual

Page 151

Advertising
background image

151

After you’ve written your application, tested it, and verified that it works
properly, it’s ready to be deployed for use by your customers. Before you
deploy, you’ll want to perform some finishing touches. For example, if you
included any

logWithFormat:

(or

logString

) statements in your code for debugging

purposes, you’ll probably want to remove them before you deploy.

This chapter describes finishing touches that you might want to add after
you’re through debugging the bulk of your application’s code. It covers such
topics as how to record application usage statistics, how to shut down an
application gracefully, how to substitute your own code when an error
occurs, and how to improve the application’s performance.

You’ll also want to read the online document Serving WebObjects. This
document is intended for the person who sets up the website and maintains
the application after it is deployed. It covers such topics as how to perform
load balancing, how to maintain a log file, and how to test and improve
performance of the applications running on a site.

Recording Application Statistics

While your application runs, a WOStatisticsStore object (StatisticsStore in
Java) records statistics about the application. It records such information as
how many sessions are active, how many requests have been processed, and
which pages have been accessed. This section describes how to maintain a
log file, access those statistics, and add to them.

Maintaining a Log File

WOStatisticsStore has the ability to record session information to a log file
that can be analyzed by a Common Log File Format (CLFF) standard
analysis tool. WOStatisticsStore does not maintain this log file by default.
To store information in a log file, you must set the path to the log file early
in your application. For example:

// Java
public Application() {

super();
this.statisticsStore().setLogFile("/tmp/WebObjects.log", 1);
...

}

When a log file is set, WOStatisticsStore records all information returned by

descriptionForResponse:inContext:

to that log file at the end of each cycle of the

request-response loop.

Advertising