Alternatives

Older alternatives to tracing

Tracing is now the "go-to" crate for logging.

log

log

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.

log4rs

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

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

OpenObserve

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