On 07/25/2014 08:28 PM, Zhang Haoyu wrote: >> In a shell you would write something like: >> >> 2> stderr.log >> >> You may also want to toggle QEMU's -msg timestamp=on option. >> > I think the "-msg -msg timestamp=on" option will add timestamp to the output of error_report(fmt, ...), > but where is the output? Which file saves the output? The output is on qemu's stderr. You are in control of what that stderr is. > And where is the output of fprintf(stderr, fmt, ...)? Also on stderr. > Should I redirect of stderr to specified log file? Yes, if you want that output going to a specified file. > > In libvirt code, when start a vm(qemuProcessStart), it will create a qemu log file named /var/log/libvirt/qemu/vmname.log, > and redirect the stderr and stdout to file descriptor of this qemu log file. > > But if I run a vm directly by qemu command, bypass libvirt, then how to configure qemu to assure that each vm has its own log file, > and how to redirect the stderr, stdout to each vm's own log file? If you are going to bypass libvirt, then you have to do your own shell redirections (as mentioned above) to ensure that file descriptor 2 as inherited by qemu is whatever file you want errors logged in. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org