Graham Dumpleton wrote ..
> Graham Dumpleton wrote ..
> > Hopefully everyone follows what I am talking about. I will try and get
> > together a working example today of what I am talking about, but Nick,
> > you may want to consider posting your code and how you are using it
> > as it probably will not be too different.
> 
> Okay, here is my suggested code. I have bundled it up as a tar file as
> a
> complete working example as easier than explaining how to set it up for
> testing. The .htaccess file sets up two handler phases, ie. separates
> out the request caching bits as the intent would be that that all be
> done in mod_python and be transparent anyway.
> 
> Note that I suspect that the log level mapping as described so far isn't
> adequate as log levels can be arbitrary and may fall between the
> predefined levels.

Here is an alternate "mptest.py" example which shows how logging can
still work at global level.

  from mod_python import apache
  import logging

  log = logging.getLogger("mod_python")
  log.warning("importing handler")

  def handler(req):
    log.warning("running handler")
    req.content_type = 'text/plain'
    req.send_http_header()
    req.write('hello\n')
    return apache.OK

Reply via email to