ServletFramework
94
becomes congested. Although the servlet may bef orced tow aitbe fore it can send more data, any other
jobs in the event system will still be serviced, including other HTTP requests.
Logging of Requests
By default no information islogged about requests. If you wish to log what requests are being made
against your application using the HTTP servlet framework, you need to set the environment variable
"OTCLIB_HTTPLOGCHANNEL"to the name of the log channel to record the information on. The en-
vironment variable needs to bes et priorto the first request being received by the application through
any instance of the HttpDaemon class.
dispatcher = netsvc.Dispatcher()
dispatcher.monitor(signal.SIGINT)
netsvc.mergeEnviron("OTCLIB_HTTPLOGCHANNEL","")
daemon = netsvc.HttpDaemon(8000)
filesrvr = netsvc.FileServer(os.getcwd())
daemon.attach("/",filesrvr)
daemon.start()
dispatcher.run()
The format of thelogge dm essagesi sthe same as Apache web server common log file format except
that no matter what version of HTTP is used, the url component of the request is always expanded to
itscomplete form. That is, it will be prefixed with " http://hostname:port"as appropriate.Nor-
mally this would only be thec ase if the request originated with a client supporting HTTP/1.1 protocol
and a full url had been suppliedby the client.
Ifyou donot want information about requests appearing in the default log f ile,but w ant tosplit out the
loggedmessages intoa distinct log file, or otherwise treat them in a special way, use a hidden log chan-
nel and create a user defined log channel toca pture them.