diff options
author | Ben Pfaff <blp@ovn.org> | 2016-03-07 15:13:15 -0800 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2016-03-07 15:13:17 -0800 |
commit | bb3384518673ec5672373b5176e77a6f0a5f9137 (patch) | |
tree | 387f3864e0f3cf18d33837bd3d71144bc453d8be /lib/unixctl.c | |
parent | 0c0afad722d9758b6c50b91300d807a8f6d390d8 (diff) | |
download | openvswitch-bb3384518673ec5672373b5176e77a6f0a5f9137.tar.gz |
unixctl: Log commands received and their replies (at debug level).
These commands are also visible through the "jsonrpc" module, but turning
up the log level there also exposes a lot of OVSDB traffic that usually
isn't interesting.
Also, enable this logging for the tests.
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
Diffstat (limited to 'lib/unixctl.c')
-rw-r--r-- | lib/unixctl.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/unixctl.c b/lib/unixctl.c index b47f35ad0..c1a504805 100644 --- a/lib/unixctl.c +++ b/lib/unixctl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc. + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2016 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -151,6 +151,13 @@ unixctl_command_reply__(struct unixctl_conn *conn, reply = jsonrpc_create_error(body_json, conn->request_id); } + if (VLOG_IS_DBG_ENABLED()) { + char *id = json_to_string(conn->request_id, 0); + VLOG_DBG("replying with %s, id=%s: \"%s\"", + success ? "success" : "error", id, body); + free(id); + } + /* If jsonrpc_send() returns an error, the run loop will take care of the * problem eventually. */ jsonrpc_send(conn->rpc, reply); @@ -268,6 +275,15 @@ process_command(struct unixctl_conn *conn, struct jsonrpc_msg *request) COVERAGE_INC(unixctl_received); conn->request_id = json_clone(request->id); + if (VLOG_IS_DBG_ENABLED()) { + char *params_s = json_to_string(request->params, 0); + char *id_s = json_to_string(request->id, 0); + VLOG_DBG("received request %s%s, id=%s", + request->method, params_s, id_s); + free(params_s); + free(id_s); + } + params = json_array(request->params); command = shash_find_data(&commands, request->method); if (!command) { |