Logging in the wasmtime
CLI
Wasmtime's libraries use Rust's log
crate to log diagnostic information, and the wasmtime
CLI executable uses tracing-subscriber
for displaying this information on the console.
Basic logging is controlled by the WASMTIME_LOG
environment variable. For example, To enable logging of WASI system calls, similar to the strace
command on Linux, set WASMTIME_LOG=wasmtime_wasi=trace
. For more information on specifying filters, see tracing-subscriber's EnvFilter docs.
Wasmtime can also redirect the log messages into log files, with the -D log-to-files
option. It creates one file per thread within Wasmtime, with the files named wasmtime.dbg.*
.
Additional environment variables that work with WASMTIME_LOG
(not -D log-to-files
):
WASMTIME_LOG_NO_CONTEXT
: if set to1
, removes the time, level and target from output.