Modify ↓
Opened 13 years ago
Last modified 13 years ago
#10052 new defect
Exception logging in XML-RPC and JSON-RPC is different
Reported by: | Karl | Owned by: | osimons |
---|---|---|---|
Priority: | normal | Component: | XmlRpcPlugin |
Severity: | normal | Keywords: | |
Cc: | Olemis Lang | Trac Release: | 0.12 |
Description
Exceptions raised in the XML-RPC component are logged in the send_rpc_error() method. The corresponding method in the JSON-RPC method does not include any logging.
This means that tracebacks are shown to the user, but don't exist in the logs, which is an issue for debugging.
I've attached a patch which simply adds a log.exception call to the JSON-RPC send_rpc_error method.
Attachments (1)
Change History (3)
Changed 13 years ago by
Attachment: | jsonrpc_logging_v2.patch added |
---|
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
A few comments:
- Having each handler log errors as it wants is fine by me. Somehow doing this in a shared location will just add complicated scaffolding with entangled code that will just come back and bite us later. I'm fine with the approach suggested in the patch.
- I don't think
log.exception()
is available for all the versions of Trac the plugin supports, and just for this purpose I addedtracrpc.util.exception_to_unicode()
compat handling to ensure we have a way that works for all. Grep the code to see examples of its use. - I actually don't think you can do logging as the last line if
send_rpc_error()
. Does that really work?_send_response()
will actually raiseRequestDone
which in turn should abort any further execution. Move the exception logging one line up to log before sending the response.
Care to update the patch?
Note: See
TracTickets for help on using
tickets.
It'd be nice to have a generic solution for this i.e.
log.exception
always called from a single location no matter what RPC protocol handler is involved .