Alternatives

Use older alternatives to tracing

tracing is now the "go-to" crate for logging, but log, slog and log4rs are still in extensive use.

log

log log-crates.io log-github log-lib.rs cat-development-tools::debugging

log is an older and simpler crate, if your needs are simple and you are not using any async code.

slog

slog slog-crates.io slog-github slog-lib.rs cat-development-tools::debugging

Structured, extensible, composable logging. slog remains a stable, featureful and battle-tested library, used in many important projects.

fn main() {
    todo!();
}

log4rs

log4rs log4rs-crates.io log4rs-github log4rs-lib.rs

log4rs is a highly configurable multi-output logging implementation for the log facade.

use log::{error, info, warn};
use log4rs;

fn main() {
    log4rs::init_file("config/log4rs.yaml", Default::default()).unwrap();

    info!("booting up");

    // ...
}

env_logger

env_logger env_logger-crates.io env_logger-github env_logger-lib.rs cat-development-tools::debugging

A logging implementation for log which is configured via an environment variable. env_logger makes sense when used in executables (binary projects). Libraries should use the log crate instead.

use log::info;

fn main() {
    env_logger::init();

    info!("starting up");

    // ...
}

Other frameworks

OpenTelemetry

OpenTelemetry Rust documentation

fn main() {
    todo!();
}

OpenObserve

OpenObserve⮳ (written in Rust) is a petabyte-scale Elasticsearch/Splunk/Datadog alternative for logs, metrics, traces, RUM, error tracking, and session replay.

fn main() {
    todo!();
}