PATH |
WOStatisticsStore
Inherits from: Object
Package: com.webobjects.appserver
Class Description
The WOStatisticsStore object records statistics about a WebObjects application while that application runs. All WebObjects applications have a WOStatisticsStore object, which you can access by sending statisticsStore to the WOApplication object.
Recording Information
The WOStatisticsStore object records the bulk of its statistics at the end of each cycle of the request-response loop. Specifically, at the end of WOSession's appendToResponse method, the WOSession sends the recordStatisticsForResponse message to the WOStatisticsStore. This message tells the WOStatisticsStore to begin recording statistics. Then, WOSession sends it a descriptionForResponse message. This method sends the response component a descriptionForResponse message. The default implementation of descriptionForResponse in WOComponent returns the component's name.
You can override descriptionForResponse in each of your components if you want to record more information. For example, you might want to record the values of all of the component's variables or perhaps just one or two key variables.
If you want to record extra information about the session, you can override WOStatisticsStore's recordStatisticsForResponse method.
Maintaining a Log File
You can maintain an application log file by sending the message setLogFile to the WOStatisticsStore object. When a log file has been specified, each session records information in the log file about the pages it accessed.
The log is maintained in Common Log File Format (CLFF) so that it can be analyzed by any standard CLFF-analysis tool. (For more information about the statistics recorded in the log file, see the formatDescription method description.) If a log file has been specified, the WOSession object keeps its own statistics about which pages it has accessed. When the session terminates, it writes this information to the log file.
Method Types
Constructor WOStatisticsStore Recording information applicationDidHandleComponentActionRequestWithPageNamed applicationDidHandleDirectActionRequestWithActionNamed applicationWillHandleComponentActionRequest applicationWillHandleDirectActionRequest recordStatisticsForResponse descriptionForResponse setSessionMovingAverageSampleSize transactionMovingAverageSampleSize Retrieving information statistics memoryUsage Maintaining a CLFF log file setLogFile logFileRotationFrequencyInDays logFile Recording information in the CLFF log file formatDescription logString Securing access to the WOStats page setPassword validateLogin
Constructors
WOStatisticsStore
protected WOStatisticsStore()
Instance Methods
applicationDidHandleComponentActionRequestWithPageNamed
public void applicationDidHandleComponentActionRequestWithPageNamed( String pageName)
applicationDidHandleDirectActionRequestWithActionNamed
public void applicationDidHandleDirectActionRequestWithActionNamed( String anActionName)
applicationWillHandleComponentActionRequest
public void applicationWillHandleComponentActionRequest()
applicationWillHandleDirectActionRequest
public void applicationWillHandleDirectActionRequest()
descriptionForResponse
public String descriptionForResponse( WOResponse aResponse, WOContext aContext)
formatDescription
public String formatDescription( String responseDescription, WOResponse aResponse, WOContext aContext)
- The host from which the HTTP request was received
- The name of the user that performed the request
- The current date
- The request's HTTP method (GET or PUT)
- The WebObjects application name
- The result of the descriptionForResponse method (by default, this method returns the response component's name)
- The request's HTTP version
- The HTTP status of the response
- The size of the response
You enable log file recording by setting a log file using the setLogFile method.
This method is used by WOSession to record information about the current transaction when log file recording is enabled.
logFile
public String logFile()
See Also: formatDescription, logFileRotationFrequencyInDays, logString
logFileRotationFrequencyInDays
public double logFileRotationFrequencyInDays()
Before a new log file is started, the contents of the current log file are saved to a backup file. You can then inspect this log file and/or remove it when its data has grown stale.
See Also: setLogFile
logString
public void logString(String aString)
See Also: formatDescription
memoryUsage
public NSMutableDictionary memoryUsage()
recordStatisticsForResponse
public void recordStatisticsForResponse( WOResponse aResponse, WOContext aContext)
sessionMovingAverageSampleSize
public int sessionMovingAverageSampleSize()
See Also: setSessionMovingAverageSampleSize
setLogFile
public void setLogFile( String filePath, double logRotation)
The default is not to record information to a log file.
See Also: logFile, logFileRotationFrequencyInDays
setPassword
public void setPassword(String aPassword)
See Also: validateLogin
setSessionMovingAverageSampleSize
public void setSessionMovingAverageSampleSize(int aSize)
The default moving average session sample size is 10 transactions.
See Also: sessionMovingAverageSampleSize
setTransactionMovingAverageSampleSize
public void setTransactionMovingAverageSampleSize(int aSize)
The default moving average transaction sample size is 100 transactions.
See Also: transactionMovingAverageSampleSize
statistics
public NSDictionary statistics()
The averages that are displayed by this method are not computed until this method is invoked. Therefore, invoking this method is costly and should not be done at every request.
transactionMovingAverageSampleSize
public int transactionMovingAverageSampleSize()
See Also: setTransactionMovingAverageSampleSize
validateLogin
public boolean validateLogin( String string, WOSession aSession)
© 2001 Apple Computer, Inc. (Last Published April 15, 2001)