Is everyone here called Nic[h]olas?

Nicolas Lehuen <[EMAIL PROTECTED]> writes:

> Nic, there is something I need to understand before giving my advice on the
> subject. I'm not familiar with the logging API, can you tell me how you
> configure Python to use this logging implementation ? Looks like we have to
> manipulate configuration object, set up handlers and so on... If so I guess
> we'd have to add a word or two in the documentation on the best way to do
> this in the mod_python context...

Hmmm... logging is actually very simple if you want it to be.

All you really have to do to use logging from Python is this:

  import logging

  # then sometime later

  logger = logging.getLogger()
  logger.debug("a log message")


lot's more things are possible and the logging API is very
configurable.


>From an Apache point of view you do need to configure the default
logger in your handler so that it has access to the apache vhost
logger:


    hdlr = apache_log_handler.ApacheLogHandler(http)
    logging.getLogger().addHandler(hdlr)

once you've done that then any handler which descends from the default
handler (and that's the normal way to do things) will log to Apache.



Nic

Reply via email to