Exceptions raised by the python server are not logged as errors, this could result in most of them to be missing from the log files.
I noticed that when some code I added to the python server caused an internal exception: the logs didn't contain any useful information Cheers Flavio -- Flavio Castelli SUSE LINUX Products GmbH Maxfeldstraße 5, 90409 Nürnberg Germany
>From 30cd21a0d00a4c7fae72bbf1f2aebe530117359a Mon Sep 17 00:00:00 2001 From: Flavio Castelli <fcaste...@suse.com> Date: Tue, 12 Nov 2013 11:40:39 +0100 Subject: [PATCH] python server: better logging of exceptions Ensured all the exceptions are logged, no matter which log level is being used by the logger. --- backend/server/apacheRequest.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/backend/server/apacheRequest.py b/backend/server/apacheRequest.py index 145189a..84ea623 100644 --- a/backend/server/apacheRequest.py +++ b/backend/server/apacheRequest.py @@ -151,13 +151,13 @@ class apacheRequest: except rhnSQL.SQLSchemaError, e: f = None if e.errno == 20200: - log_debug(2, "User Group Membership EXCEEDED") + log_error("User Group Membership EXCEEDED") f = rhnFault(43, e.errmsg) elif e.errno == 20220: - log_debug(2, "Server Group Membership EXCEEDED") + log_error("Server Group Membership EXCEEDED") f = rhnFault(44, e.errmsg) if not f: - log_debug(4, "rhnSQL.SQLSchemaError caught", e) + log_error("rhnSQL.SQLSchemaError caught", e) rhnSQL.rollback() # generate the traceback report Traceback(method, self.req, @@ -166,13 +166,14 @@ class apacheRequest: return apache.HTTP_INTERNAL_SERVER_ERROR response = f.getxml() except rhnSQL.SQLError, e: - log_debug(4, "rhnSQL.SQLError caught", e) + log_error("rhnSQL.SQLError caught", e) rhnSQL.rollback() Traceback(method, self.req, extra="SQL Error generated: %s" % e, severity="schema") return apache.HTTP_INTERNAL_SERVER_ERROR - except: + except Exception, e: + log_error("Unhandled exception", e) rhnSQL.rollback() # otherwise we do a full stop Traceback(method, self.req, severity="unhandled") -- 1.8.1.4
_______________________________________________ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel