Login

Snippets by adroffner

Snippet List

MODPYTHON Sample Site Logging

This sample site_logging.py module uses the [MODPYTHON Logging snippet](http://www.djangosnippets.org/snippets/627/). It assigns the ApacheLogHandler class to the main logging object, when Django is run inside MODPYTHON. You must have the MODPYTHON Logging snippet, and name it modpython_logging.py for this to work. Apache will write to virtual host-specific logs only with Python 2.5. Users are encouraged to change the two logging settings. Log Level: handler.setLevel(logging.WARNING) Log Format: logging.Formatter(...)

  • logging
  • mdpython
Read More

MODPYTHON logging

A MODPYTHON Apache Log Handler This module provides a logging Handler class to a MODPYTHON Apache server. Python's standard [logging API](http://www.python.org/doc/2.5/lib/module-logging.html) explains how to [use a handler](http://www.python.org/doc/2.5/lib/multiple-destinations.html). The handler, by default, writes entries to the Apache error_log using the standard Python logging API. VIRTUAL HOSTS (Python 2.5) This handler also supports Apache Virtual Hosts where the mp_server object is available. Then, it writes entries to the specific virtual-host server's error_log. To get the mp_server object out of Django, you need the **log_extras()** function in your logging call (See the source comments). This module must be bound to the Python logging API. Use a site_logging.py module to do that as this [related example](http://www.djangosnippets.org/snippets/960/) shows.

  • logging
  • modpython
Read More

adroffner has posted 2 snippets.