You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-commits@quetz.apache.org by nl...@apache.org on 2005/03/17 21:40:22 UTC

svn commit: r157973 - httpd/mod_python/trunk/src/mod_python.c

Author: nlehuen
Date: Thu Mar 17 12:40:20 2005
New Revision: 157973

URL: http://svn.apache.org/viewcvs?view=rev&rev=157973
Log:
Fix for MODPYTON-35 : mod_python.c doesn't always log reason for 500 error.

Modified:
    httpd/mod_python/trunk/src/mod_python.c

Modified: httpd/mod_python/trunk/src/mod_python.c
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/src/mod_python.c?view=diff&r1=157972&r2=157973
==============================================================================
--- httpd/mod_python/trunk/src/mod_python.c (original)
+++ httpd/mod_python/trunk/src/mod_python.c Thu Mar 17 12:40:20 2005
@@ -96,13 +96,13 @@
 
     if (! ((m = PyImport_ImportModule(MODULENAME)))) {
         ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, s,
-                     "make_obcallback: could not import %s.\n", MODULENAME);
+                     "make_obcallback: could not import %s.\n", (!MODULENAME) ? "<null>" : MODULENAME);
         PyErr_Print();
     }
     
     if (m && ! ((obCallBack = PyObject_CallMethod(m, INITFUNC, NULL)))) {
         ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, s,
-                     "make_obcallback: could not call %s.\n", INITFUNC);
+                     "make_obcallback: could not call %s.\n", (!INITFUNC) ? "<null>" : INITFUNC);
         PyErr_Print();
     }
     
@@ -130,8 +130,11 @@
     PyEval_AcquireLock();
 #endif
 
-    if (!interpreters)
+    if (!interpreters) {
+         ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, srv,
+                       "python_handler: interpreters dictionary not initialised.");
         return NULL;
+    }
 
     p = PyDict_GetItemString(interpreters, (char *)name);
     if (!p)
@@ -179,6 +182,8 @@
             PyEval_ReleaseThread(tstate);
 #endif
             PyThreadState_Delete(tstate);
+            ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, srv,
+                      "python_handler: no interpreter callback found.");
             return NULL;
         }
     }
@@ -1036,8 +1041,11 @@
     /* get/create interpreter */
     idata = get_interpreter(interp_name, req->server);
 
-    if (!idata)
+    if (!idata) {
+        ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, req,
+                      "python_handler: Can't get/create interpreter.");
         return HTTP_INTERNAL_SERVER_ERROR;
+    }
     
     /* create/acquire request object */
     request_obj = get_request_object(req, interp_name, phase);
@@ -1220,8 +1228,11 @@
     /* get/create interpreter */
     idata = get_interpreter(interp_name, con->base_server);
 
-    if (!idata)
+    if (!idata) {
+        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, con->base_server,
+                      "python_handler: Can't get/create interpreter.");
         return HTTP_INTERNAL_SERVER_ERROR;
+    }
     
     /* create connection object */
     conn_obj = (connobject*) MpConn_FromConn(con);
@@ -1317,8 +1328,11 @@
     /* get/create interpreter */
     idata = get_interpreter(interp_name, req->server);
    
-    if (!idata)
+    if (!idata) {
+        ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, req,
+                      "python_handler: Can't get/create interpreter.");
         return HTTP_INTERNAL_SERVER_ERROR;
+    }
 
     /* create/acquire request object */
     request_obj = get_request_object(req, interp_name, 
@@ -1855,7 +1869,7 @@
             if (PyErr_Occurred())
                 PyErr_Print();
             ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, s,
-                         "directive_PythonImport: error importing %s", module_name);
+                         "directive_PythonImport: error importing %s", (!module_name) ? "<null>" : module_name);
         }
 
         /* release interpreter */