qemu-log: default to stderr for logging output

Switch the default for qemu_log logging output from "/tmp/qemu.log"
to stderr. This is an incompatible change in some sense, but logging
is mostly used for debugging purposes so it shouldn't affect production
use. The previous behaviour can be obtained by adding "-D /tmp/qemu.log"
to the command line.

This change requires us to:
 * update all the documentation/help text (we take the opportunity
   to smooth out minor inconsistencies between the phrasing in
   linux-user/bsd-user/system help messages)
 * make linux-user and bsd-user defer to qemu-log for the default
   logging destination rather than overriding it themselves
 * ensure that all logfile closing is done via qemu_log_close()
   and that that function doesn't close stderr
as well as the obvious change to the behaviour of do_qemu_set_log()
when no logfile name has been specified.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1361901160-28729-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Peter Maydell 2013-02-26 17:52:40 +00:00 committed by Anthony Liguori
parent ab4004495c
commit 989b697ddd
8 changed files with 42 additions and 53 deletions

View file

@ -35,8 +35,6 @@
#include "qemu/envlist.h"
#include "elf.h"
#define DEBUG_LOGFILE "/tmp/qemu.log"
char *exec_path;
int singlestep;
@ -3296,9 +3294,10 @@ static const struct qemu_argument arg_table[] = {
"size", "reserve 'size' bytes for guest virtual address space"},
#endif
{"d", "QEMU_LOG", true, handle_arg_log,
"options", "activate log"},
"item[,...]", "enable logging of specified items "
"(use '-d help' for a list of items)"},
{"D", "QEMU_LOG_FILENAME", true, handle_arg_log_filename,
"logfile", "override default logfile location"},
"logfile", "write logs to 'logfile' (default stderr)"},
{"p", "QEMU_PAGESIZE", true, handle_arg_pagesize,
"pagesize", "set the host page size to 'pagesize'"},
{"singlestep", "QEMU_SINGLESTEP", false, handle_arg_singlestep,
@ -3351,11 +3350,9 @@ static void usage(void)
printf("\n"
"Defaults:\n"
"QEMU_LD_PREFIX = %s\n"
"QEMU_STACK_SIZE = %ld byte\n"
"QEMU_LOG = %s\n",
"QEMU_STACK_SIZE = %ld byte\n",
interp_prefix,
guest_stack_size,
DEBUG_LOGFILE);
guest_stack_size);
printf("\n"
"You can use -E and -U options or the QEMU_SET_ENV and\n"
@ -3439,7 +3436,6 @@ static int parse_args(int argc, char **argv)
int main(int argc, char **argv, char **envp)
{
const char *log_file = DEBUG_LOGFILE;
struct target_pt_regs regs1, *regs = &regs1;
struct image_info info1, *info = &info1;
struct linux_binprm bprm;
@ -3482,8 +3478,6 @@ int main(int argc, char **argv, char **envp)
cpudef_setup(); /* parse cpu definitions in target config file (TBD) */
#endif
/* init debug */
qemu_set_log_filename(log_file);
optind = parse_args(argc, argv);
/* Zero out regs */