Search code examples
loggingautomated-testssubstratepolkadot

How to see logs out of tests running Substrate Cumulus based runtime?


I have test. It runs full runtime. I sure there are logs along the stack. But I cannot see them in output.

I run test like that:

RUST_LOG=trace,parity-db=error,trie=error,runtime=trace,substrate-relay=trace,bridge=trace cargo ltest my_runtime::xcm_test -- --nocapture

What should I do to see logs in tests?


Solution

  • substrate uses usual next logger

    /// this must be singleton
    #[cfg(test)]
    pub fn env_logger_init() {
        let _ = env_logger::builder().is_test(true).try_init();
    }