From: "Denis V. Lunev" <den@openvz.org>
Cc: Pavel Butsykin <pbutsykin@virtuozzo.com>,
Markus Armbruster <armbru@redhat.com>,
qemu-devel@nongnu.org, Luiz Capitulino <lcapitulino@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
"Denis V. Lunev" <den@openvz.org>
Subject: [Qemu-devel] [PATCH 6/9] log: log QMP commands and replies
Date: Mon, 14 Mar 2016 14:21:38 +0300 [thread overview]
Message-ID: <1457954501-26528-7-git-send-email-den@openvz.org> (raw)
In-Reply-To: <1457954501-26528-1-git-send-email-den@openvz.org>
From: Pavel Butsykin <pbutsykin@virtuozzo.com>
This log would be very welcome for long-term diagnostics of the system
in the production. This log is at least necessary to understand what
has been happened on the system and to identify issues at higher-level
subsystems (libvirt, etc).
These messages will be quite useful to understand how things are going.
Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Stefan Hajnoczi <stefanha@redhat.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Luiz Capitulino <lcapitulino@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
CC: Eric Blake <eblake@redhat.com>
---
include/qemu/log.h | 1 +
monitor.c | 13 +++++++++++++
util/log.c | 2 ++
3 files changed, 16 insertions(+)
diff --git a/include/qemu/log.h b/include/qemu/log.h
index a05c7dc..55bceae 100644
--- a/include/qemu/log.h
+++ b/include/qemu/log.h
@@ -42,6 +42,7 @@ static inline bool qemu_log_separate(void)
#define CPU_LOG_TB_NOCHAIN (1 << 13)
#define CPU_LOG_PAGE (1 << 14)
#define LOG_TRACE (1 << 15)
+#define LOG_QMP (1 << 16)
/* Returns true if a bit is set in the current loglevel mask
*/
diff --git a/monitor.c b/monitor.c
index e99ca8c..eec4e58 100644
--- a/monitor.c
+++ b/monitor.c
@@ -437,6 +437,12 @@ static void monitor_protocol_emitter(Monitor *mon, QObject *data,
}
monitor_json_emitter(mon, QOBJECT(qmp));
+ if (qemu_loglevel_mask(LOG_QMP)) {
+ QString *output_json = qobject_to_json(QOBJECT(qmp));
+ qemu_log_mask(LOG_QMP, "QMP reply: %s\n", output_json->string);
+ QDECREF(output_json);
+ }
+
QDECREF(qmp);
}
@@ -3867,6 +3873,11 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens)
goto err_out;
}
+ if (qemu_loglevel_mask(LOG_QMP)) {
+ QString *output_json = qobject_to_json(obj);
+ qemu_log_mask(LOG_QMP, "QMP command: %s\n", output_json->string);
+ QDECREF(output_json);
+ }
input = qmp_check_input_obj(obj, &local_err);
if (!input) {
qobject_decref(obj);
@@ -3988,12 +3999,14 @@ static void monitor_qmp_event(void *opaque, int event)
monitor_json_emitter(mon, data);
qobject_decref(data);
mon_refcount++;
+ qemu_log_mask(LOG_QMP, "QMP: new connection established\n");
break;
case CHR_EVENT_CLOSED:
json_message_parser_destroy(&mon->qmp.parser);
json_message_parser_init(&mon->qmp.parser, handle_qmp_command);
mon_refcount--;
monitor_fdsets_cleanup();
+ qemu_log_mask(LOG_QMP, "QMP: connection closed\n");
break;
}
}
diff --git a/util/log.c b/util/log.c
index 65d46e2..5fc517b 100644
--- a/util/log.c
+++ b/util/log.c
@@ -131,6 +131,8 @@ const QEMULogItem qemu_log_items[] = {
{ CPU_LOG_TB_NOCHAIN, "nochain",
"do not chain compiled TBs so that \"exec\" and \"cpu\" show\n"
"complete traces" },
+ { LOG_QMP, "qmp",
+ "log the QMP commands and events" },
{ 0, NULL, NULL },
};
--
2.5.0
next prev parent reply other threads:[~2016-03-14 11:22 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-14 11:21 [Qemu-devel] [PATCH v2 0/9] log: assorted improvements Denis V. Lunev
2016-03-14 11:21 ` [Qemu-devel] [PATCH 1/9] trace: do not always call exit() in trace_enable_events Denis V. Lunev
2016-03-14 14:25 ` Paolo Bonzini
2016-03-14 11:21 ` [Qemu-devel] [PATCH 2/9] qemu-log: fix cpu_reset log target Denis V. Lunev
2016-03-14 14:24 ` Paolo Bonzini
2016-03-14 11:21 ` [Qemu-devel] [PATCH 3/9] log: improve code in do_qemu_set_log Denis V. Lunev
2016-03-14 14:28 ` Paolo Bonzini
2016-03-16 11:20 ` Denis V. Lunev
2016-03-16 11:25 ` Paolo Bonzini
2016-03-14 11:21 ` [Qemu-devel] [PATCH 4/9] log: move qemu_log_close/qemu_log_flush from header to log.c Denis V. Lunev
2016-03-14 14:29 ` Paolo Bonzini
2016-03-14 11:21 ` [Qemu-devel] [PATCH 5/9] log: improve performance of qemu_log and qemu_log_mask if disabled Denis V. Lunev
2016-03-14 14:30 ` Paolo Bonzini
2016-03-14 15:07 ` Denis V. Lunev
2016-03-14 11:21 ` Denis V. Lunev [this message]
2016-03-14 14:33 ` [Qemu-devel] [PATCH 6/9] log: log QMP commands and replies Paolo Bonzini
2016-03-14 14:38 ` Daniel P. Berrange
2016-03-14 15:00 ` Denis V. Lunev
2016-03-14 15:05 ` Denis V. Lunev
2016-03-14 15:26 ` Daniel P. Berrange
2016-03-14 16:10 ` Denis V. Lunev
2016-03-14 16:37 ` Paolo Bonzini
2016-03-14 16:11 ` Daniel P. Berrange
2016-03-14 16:16 ` Denis V. Lunev
2016-03-14 16:40 ` Paolo Bonzini
2016-03-16 13:09 ` Denis V. Lunev
2016-03-16 13:11 ` Paolo Bonzini
2016-03-17 15:31 ` Daniel P. Berrange
2016-03-14 11:21 ` [Qemu-devel] [PATCH 7/9] log: report HMP command and event Denis V. Lunev
2016-03-14 14:36 ` Paolo Bonzini
2016-03-14 15:08 ` Denis V. Lunev
2016-03-14 16:35 ` Paolo Bonzini
2016-03-14 11:21 ` [Qemu-devel] [PATCH 8/9] log: report QAPI event Denis V. Lunev
2016-03-14 14:33 ` Paolo Bonzini
2016-03-14 11:21 ` [Qemu-devel] [PATCH 9/9] log: adds a timestamp to each log entry Denis V. Lunev
2016-03-14 14:39 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1457954501-26528-7-git-send-email-den@openvz.org \
--to=den@openvz.org \
--cc=armbru@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pbutsykin@virtuozzo.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).