logging and debugging for qemu virtual machines
qemu
command accepts a simple -D
switch which can create a log file. So for example including -D ./log.txt
will create "log.txt" in your working directory.
You can access more logging/debugging options via QEMU Monitor (e.g. qemu -monitor stdio
).
If you use the -d <component>
parameter when starting up QEMU, it will enable debugging for that component. This is useful if you have the QEMU source code and want to see detailed debugs for a given component.
For example, passing -d cpu_reset
will enable CPU_LOG_RESET debugging which will "show CPU state before CPU resets". See qemu/util/log.c for a full list of logging options.
By default, logs are written to /tmp/qemu.log, but you can specify a different log file with the -D <logfile>
parameter.
Any logging option provided by QEMU will be far too low-level for what you need: your problem is not that the virtual hardware is misbehaving, only that the software inside the VM needs attention.
In this respect a VM is no different to a real machine, and the solution is the same. Your question suggests that the VM is running FreeBSD, so you should check out using rsyslog
to push the logs to an external syslog server (which could be your host machine) via the network connection.
(I'm not very familiar with the BSDs, so I'm not 100% certain that rsyslog
is the right or only solution here, but that keyword should get you started.)