@@ -56,6 +56,10 @@ void do_qemu_set_log(int log_flags, bool use_own_buffers)
#ifdef CONFIG_TRACE_LOG
qemu_loglevel |= LOG_TRACE;
#endif
+ /* Setup the logfile when:
+ * - The loglevel is set via -d option or CONFIG_TRACE_LOG, or
+ * - Both -daemonize and -D options are given
+ */
if (!qemu_logfile &&
(is_daemonized() ? logfilename != NULL : qemu_loglevel)) {
if (logfilename) {
@@ -91,6 +95,10 @@ void do_qemu_set_log(int log_flags, bool use_own_buffers)
log_append = 1;
}
}
+ /* Close the already setup logfile when loglevel gets reset (e.g.
+ * via the log HMP command), unless both -daemonize and -D options
+ * are given.
+ */
if (qemu_logfile &&
(is_daemonized() ? logfilename == NULL : !qemu_loglevel)) {
qemu_log_close();