Inherits from: NSObject
Package: com.apple.yellow.webobjects
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.
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.
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.
- Constructor
- WOStatisticsStore
- Recording information
- recordStatisticsForResponse
- descriptionForResponse
- setSessionMovingAverageSampleSize
- transactionMovingAverageSampleSize
- Retrieving information
- statistics
- 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
public WOStatisticsStore()
public String descriptionForResponse(
WOResponse aResponse,
WOContext aContext)
public String formatDescription(
String responseDescription,
WOResponse aResponse,
WOContext aContext)
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.
public void lock()
Locks access to the WOStatisticsStore object.
public String logFile()
See Also: formatDescription, logFileRotationFrequencyInDays, logString
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
public void logString(String aString)
See Also: formatDescription
public void recordStatisticsForResponse(
WOResponse aResponse,
WOContext aContext)
public int sessionMovingAverageSampleSize()
See Also: setSessionMovingAverageSampleSize
public void setLogFile(
String filePath,
double logRotation)
The default is not to record information to a log file.
See Also: logFile, logFileRotationFrequencyInDays
public void setPassword(String aPassword)
See Also: validateLogin
public void setSessionMovingAverageSampleSize(int aSize)
The default moving average session sample size is 10 transactions.
See Also: sessionMovingAverageSampleSize
public void setTransactionMovingAverageSampleSize(int aSize)
The default moving average transaction sample size is 100 transactions.
See Also: transactionMovingAverageSampleSize
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.
public int transactionMovingAverageSampleSize()
See Also: setTransactionMovingAverageSampleSize
public void unlock()
Unlocks access to the WOStatisticsStore object.
public boolean validateLogin(
String string,
WOSession aSession)