15.5. Logging

 <  Day Day Up  >  

On the EnvisionWare system, message logging occurs at the interfaces ("Plan Your Logging Strategy"). Since the implementations are simple, we made logging part of the implementation, instead of using a proxy. In particular, the classes containing logging calls are:

 class ClientMessageDispatcher implements MessageReceiver         Message process_message(Message message_to_process)     class ServerMessageDispatcher implements MessageReceiver         Message process_message(message_to_process) 

ClientMessageDispatcher logs all outgoing requests and returned responses. ServerMessageDispatcher logs all incoming requests and returned responses. The logs are created in a searchable format by adding a convert_to_keywords( ) method to each Message class and a encode_into_keywords( ) method to MessageEncoderDecoder ”the convert_to_keywords( ) method creates attribute/value pairs (e.g., NumberPrintJobs=2 ) for each attribute. encode_into_keywords( ) adds attribute/value pairs for the base Message class attributes. The attribute/value pairs make it easier to search and filter logs for particular messages with particular values.

One potential addition is to create decode_from_keywords( ) . You would use this method to decode each entry in a log. You could use the decoded entries to create a stream of messages that would duplicate a real or simulated stream. You could use this stream of messages for debugging and regression testing.

The ClientEnvironment and ServerEnvironment methods might also perform logging ”for example, for the client whenever the UserID was changed, or for the server whenever the database was accessed.

 <  Day Day Up  >  


Prefactoring
Prefactoring: Extreme Abstraction, Extreme Separation, Extreme Readability
ISBN: 0596008740
EAN: 2147483647
Year: 2005
Pages: 175
Authors: Ken Pugh

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net