In mod_python you can currently log to the Apache error log file using:
apache.log_error() - This is a wrapper around ap_log_error(). By default it logs against the main Apache server. You can supply an alternate server object against which to log. Which server object is used is important where you have different logs files for different virtual servers.
req.log_error() - This is a wrapper around ap_log_rerror(). This logs against the virtual server the request is being handled within. The output also includes details about the client from which the request originated.
For completeness, should add:
req.server.log_error() - Also a wrapper around ap_log_error(). Would always log to the server which the method is called against.
req.connection.log_error() - This would be a wrapper around ap_log_cerror(). Would log against the virtual server the request is being handled within. Because it is associated with a particular client, the details of the client can again be recorded in the logged message.
Note that ap_log_cerror() was only introduced during Apache 2.0.55. As a result, if an older version of Apache is used than that, instead of using ap_log_cerror(), it would use ap_log_error() and use req.connection.base_server as the server to log against. In doing this, the client information wouldn't be displayed though.