WOStatisticsStore
Inherits from: NSObject
Conforms to: NSObject
(NSObject)
Declared in: WebObjects/WOStatisticsStore.h
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:inContext: method, the WOSession sends the recordStatisticsForResponse:inContext: message to the WOStatisticsStore. This message tells the WOStatisticsStore to begin recording statistics. Then, WOSession sends it a descriptionForResponse:inContext: message. This method sends the response component a descriptionForResponse:inContext: message. The default implementation of descriptionForResponse:inContext: in WOComponent returns the component's name.
You can override descriptionForResponse:inContext: 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:inContext: method.
Maintaining a Log File
You can maintain an application log file by sending the message setLogFile:rotationFrequencyInDays: 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:forResponse:inContext: 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.
Adopted Protocols
NSLocking- lock - unlock
Method Types
- Recording information
- - recordStatisticsForResponse:inContext:
- - descriptionForResponse:inContext:
- - setSessionMovingAverageSampleSize:
- - transactionMovingAverageSampleSize
- Retrieving information
- - statistics
- Maintaining a CLFF log file
- - setLogFile:rotationFrequencyInDays:
- - logFileRotationFrequencyInDays
- - logFile
- Recording information in the CLFF log file
- - formatDescription:forResponse:inContext:
- - logString:
- Securing access to the WOStats page
- - setPassword:
- - validateLogin:forSession:
Instance Methods
descriptionForResponse:inContext:
- (NSString *)descriptionForResponse:(WOResponse
*)aResponse
inContext:(WOContext *)aContext
formatDescription:forResponse:inContext:
- (NSString *)formatDescription:(NSString
*)responseDescription
forResponse:(WOResponse *)aResponse
inContext:(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:inContext: 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:rotationFrequencyInDays: method.
This method is used by WOSession to record information about the current transaction when log file recording is enabled.
See Also: - logFile, - logString:
logFile
- (NSString *)logFile
See Also: - formatDescription:forResponse:inContext:, - logFileRotationFrequencyInDays, - logString:
logFileRotationFrequencyInDays
- (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:rotationFrequencyInDays:
logString:
- (void)logString:(NSString
*)aString
See Also: - formatDescription:forResponse:inContext:
recordStatisticsForResponse:inContext:
- (void)recordStatisticsForResponse:(WOResponse
*)aResponse
inContext:(WOContext *)aContext
sessionMovingAverageSampleSize
- (int)sessionMovingAverageSampleSize
See Also: - setSessionMovingAverageSampleSize:
setLogFile:rotationFrequencyInDays:
- (void)setLogFile:(NSString
*)filePath
rotationFrequencyInDays:(double)logRotation
The default is not to record information to a log file.
See Also: - logFile, - logFileRotationFrequencyInDays
setPassword:
- (void)setPassword:(NSString
*)aPassword
See Also: - validateLogin:forSession:
setSessionMovingAverageSampleSize:
- (void)setSessionMovingAverageSampleSize:(int)aSize
The default moving average session sample size is 10 transactions.
See Also: - sessionMovingAverageSampleSize
setTransactionMovingAverageSampleSize:
- (void)setTransactionMovingAverageSampleSize:(int)aSize
The default moving average transaction sample size is 100 transactions.
See Also: - transactionMovingAverageSampleSize
statistics
- (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
- (int)transactionMovingAverageSampleSize
See Also: - setTransactionMovingAverageSampleSize:
validateLogin:forSession:
- (BOOL)validateLogin:(NSString
*)string
forSession:(WOSession *)aSession