Events / logging

Minnow does not make use of a logging framework, instead the WebServer class exposes events which you can subscribe to in order to allow logging using your favourite logging framework / mechanism.

ProcessingRequest event

This event occurs immediately after any new request is accepted by the web server, before a handler has been selected.

Response event

This event occurs after all processing of the request has been completed, just before the connection to the client has closed. You can use this event to record the HTTP status code of completed requests.

HandlerException event

This event occurs whenever a handler throws an unhandled exception - a HTTP status 500 response is sent to the client.

For more information on error handling see the Error handling wiki page.

General advice on handling events

All of the above events block the processing of the request, and so you should be conservative about the amount of processing that you perform while handling these events as this could have a detremental effect on performance.

Also note that the request and response properties exposed through these events are the exact same request and response objects passed to the handlers, so you should not attempt to read from the request or response streams.

Future releases of Minnow will contain more effective facilities for logging requests and responses.

Last edited Aug 3, 2010 at 10:28 AM by Kragen2uk, version 5


No comments yet.