1# Logging in the `wasmtime` CLI 2 3Wasmtime's libraries use Rust's [`log`] crate to log diagnostic 4information, and the `wasmtime` CLI executable uses [`pretty_env_logger`] 5by default for logging this information to the console. 6 7Basic logging is controlled by the `RUST_LOG` environment variable. For example, 8To enable logging of WASI system calls, similar to the `strace` command on Linux, 9set `RUST_LOG=wasi_common=trace`. 10 11```sh 12$ RUST_LOG=wasi_common=trace wasmtime hello.wasm 13[...] 14 TRACE wasi_common::hostcalls_impl::fs > fd_write(fd=1, iovs_ptr=0x10408, iovs_len=1, nwritten=0x10404) 15Hello, world! 16 TRACE wasi_common::hostcalls_impl::fs > | *nwritten=14 17 TRACE wasi_common::hostcalls > | errno=ESUCCESS (No error occurred. System call completed successfully.) 18 TRACE wasi_common::hostcalls_impl::misc > proc_exit(rval=1) 19``` 20 21Wasmtime can also redirect the log messages into log files, with the 22`--log-to-files` option. It creates one file per thread within Wasmtime, with 23the files named `wasmtime.dbg.*`. 24 25[`log`]: https://crates.io/crates/log 26[`pretty_env_logger`]: https://crates.io/crates/pretty_env_logger 27