rename QEMU device model log file by dom id and redirect stdout/stderr only if spawning device model background.
PATCH 1/1 rename QEMU device model log file by dom id and redirect stdout/stderr only if spawning device model background.
rename QEMU device model log file by dom id and redirect stdout/stderr only if spawning device model background.
Signed-off-by Zhai Edwin <[email protected]>
tools/ioemu/exec.c +4 -2
@@ -143,8 +143,10 @@setvbuf (logfile,NULL , _IOLBF,0 );#endif - stdout = logfile; - stderr = logfile; +if ( !isatty (fileno (stdout))) { + stdout = logfile; + stderr = logfile; + } } }
tools/ioemu/vl.c +6 -5
@@ -2699,11 +2699,6 @@ macaddr[4 ] =0x34 ; macaddr[5 ] =0x56 ; -/* init debug */ -sprintf (qemu_dm_logfilename,"/var/log/qemu-dm.%d.log" ,getpid ()); -cpu_set_log_filename (qemu_dm_logfilename); -cpu_set_log (0 ); - optind =1 ;for (;;) {if (optind >= argc)
@@ -2913,6 +2908,12 @@case QEMU_OPTION_d: { domid =atoi (optarg); + +/* init debug */ +sprintf (qemu_dm_logfilename,"/var/log/qemu-dm.dom%d.log" , domid); +cpu_set_log_filename (qemu_dm_logfilename); +cpu_set_log (0 ); +fprintf (logfile,"domid: %d\n" , domid); }break ;