diff options
author | Matthew Fernandez <matthew.fernandez@gmail.com> | 2011-06-07 16:32:40 +0000 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2011-06-15 16:51:24 +0000 |
commit | c235d7387c850857ec6b0ba8ee28c7e1548f68c0 (patch) | |
tree | 7ee3ca4ebda75f746d9c7ba6845b8bdab72e3f42 /vl.c | |
parent | 71f34ad05359d7fa97996562d904979281ddc7f5 (diff) |
Command line support for altering the log file location
Add command line support for logging to a location other than /tmp/qemu.log.
With logging enabled (command line option -d), the log is written to
the hard-coded path /tmp/qemu.log. This patch adds support for writing
the log to a different location by passing the -D option.
Signed-off-by: Matthew Fernandez <matthew.fernandez@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -2067,6 +2067,8 @@ int main(int argc, char **argv, char **envp) #endif int defconfig = 1; const char *trace_file = NULL; + const char *log_mask = NULL; + const char *log_file = NULL; atexit(qemu_run_exit_notifiers); error_set_progname(argv[0]); @@ -2441,7 +2443,10 @@ int main(int argc, char **argv, char **envp) break; #endif case QEMU_OPTION_d: - set_cpu_log(optarg); + log_mask = optarg; + break; + case QEMU_OPTION_D: + log_file = optarg; break; case QEMU_OPTION_s: gdbstub_dev = "tcp::" DEFAULT_GDBSTUB_PORT; @@ -2907,6 +2912,18 @@ int main(int argc, char **argv, char **envp) } loc_set_none(); + /* Open the logfile at this point, if necessary. We can't open the logfile + * when encountering either of the logging options (-d or -D) because the + * other one may be encountered later on the command line, changing the + * location or level of logging. + */ + if (log_mask) { + if (log_file) { + set_cpu_log_filename(log_file); + } + set_cpu_log(log_mask); + } + if (!st_init(trace_file)) { fprintf(stderr, "warning: unable to initialize simple trace backend\n"); } |