Skip to content
Researched developer tool comparisonsPrices dated · vendor sources linked · no star ratings
Search

Stage 01 · Write · Researched comparison

Best Rust Logging Libraries in 2026

tracing is the first pick for most new Rust projects, especially async services built on tokio, because it combines structured logging with spans and instrumentation. If you only need a simple facade with a lightweight logger, the log crate plus env_logger is the smallest setup. For configuration-driven logging with file rotation and appenders, log4rs is a common alternative.

By
Published 27 Nov 2026 · 8 tools compared

We run no ads and no affiliate links at launch. The order of a list follows our published method. See how we score.

Prices are the starting prices vendors list publicly. Plans change, so confirm the current price on the vendor page before you buy.

Key takeaways

  • tracing and log are facades: you pair them with a subscriber or logger implementation to control output.
  • All libraries listed here are free and open source, so cost is not a differentiator; licence terms and maintenance are.
  • env_logger and pretty_env_logger read filter settings from environment variables, which suits container and CI use.
  • Libraries that write to local files or stdout keep log data on your own machine; check any exporter you add for network egress.

Who each pick is for

  • Async applications that need structured logs and spanstracing
  • Libraries that want a logging facade without a backendlog
  • Command-line tools and services configured by environment variablesenv_logger
  • Teams using tracing that need filtering and formatted outputtracing-subscriber
  • Applications that want structured, typed key-value loggingslog
  • Small applications that need custom output routingfern
  • Services that need config-file driven logging and rotationlog4rs
  • Local development where readable terminal output helpspretty_env_logger

Comparison

The 8 tools at a glance
ToolBest forStandout featureListed starting priceFree plan or trial
1tracingAsync applications that need structured logs and spansSpan-based instrumentation for async codeFree (open source)Free plan
2logLibraries that want a logging facade without a backendMinimal API with macros for each levelFree (open source)Free plan
3env_loggerCommand-line tools and services configured by environment variablesFiltering through the RUST_LOG variableFree (open source)Free plan
4tracing-subscriberTeams using tracing that need filtering and formatted outputEnvFilter supports RUST_LOG-style directivesFree (open source)Free plan
5slogApplications that want structured, typed key-value loggingStructured key-value records by designFree (open source)Free plan
6fernSmall applications that need custom output routingSimple builder API for chaining outputsFree (open source)Free plan
7log4rsServices that need config-file driven logging and rotationYAML, JSON or builder configurationFree (open source)Free plan
8pretty_env_loggerLocal development where readable terminal output helpsColored, aligned output for terminalsFree (open source)Free plan

How we picked

We compared libraries on fit for common Rust logging jobs, supported platforms, licence and maintenance status, how output and filtering are configured, and the main limits of each. Sources are vendor documentation, crate documentation and project repositories. We did not run benchmarks or collect user reviews. Prices and licence terms can change, so confirm details on the project page before you commit.

The tools, one by one

01

tracing

Best for async applications that need structured logs and spans

Visit github.com
tracing homepage
tracing homepage, captured Nov 2026

What it is and where it fits

tracing is a framework for instrumenting Rust programs to collect structured, event-based diagnostic information. It records events and spans, so you can follow a request across async tasks rather than reading flat lines. It runs on any platform Rust supports, including Linux, macOS and Windows, and has no runtime dependency on tokio itself.

The crate is a facade. Output comes from a subscriber such as tracing-subscriber, which handles formatting, filtering and environment-based directives. The project is open source under the MIT licence and is maintained by the tokio-rs organisation. Skip it if you want the smallest possible dependency set for a short script.

Standout: Span-based instrumentation for async code

Pricing pointer

Free (open source), as listed by the vendor (tracing website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Span-based instrumentation for async code
  • Works with multiple subscriber backends

Drawbacks

  • More concepts to learn than a plain logger
  • Subscriber setup adds boilerplate

Skip it if this limit matters to you: more concepts to learn than a plain logger.

Verdict. A sensible pick for async applications that need structured logs and spans.

Alternatives in this guide: log, env_logger, tracing-subscriber

02

log

Best for libraries that want a logging facade without a backend

Visit github.com
log homepage
log homepage, captured Nov 2026

What it is and where it fits

log provides the standard logging macros (error, warn, info, debug, trace) and a Log trait that backends implement. It is the most widely used facade in the ecosystem, and many crates emit records through it, so a single backend can capture their output.

It has no output by itself. You choose a logger such as env_logger, fern or log4rs. The crate is open source under MIT or Apache-2.0 and works on every platform Rust targets. It is a good fit for library authors who want to log without forcing a backend on downstream users.

Standout: Minimal API with macros for each level

Pricing pointer

Free (open source), as listed by the vendor (log website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Minimal API with macros for each level
  • Widely supported by other crates

Drawbacks

  • No output on its own
  • Needs a separate logger implementation

Skip it if this limit matters to you: no output on its own.

Verdict. A sensible pick for libraries that want a logging facade without a backend.

Alternatives in this guide: tracing, env_logger, tracing-subscriber

03

env_logger

Best for command-line tools and services configured by environment variables

Visit github.com
env_logger homepage
env_logger homepage, captured Nov 2026

What it is and where it fits

env_logger is a simple logger for the log facade. It reads the RUST_LOG environment variable to set levels and per-module filters, which makes it easy to change verbosity in containers, CI jobs and local shells without recompiling.

It writes to stderr by default and supports timestamp and target formatting options. It runs on all major platforms. The crate is open source under MIT or Apache-2.0. It does not rotate files or ship logs to remote systems, so pair it with another tool if you need those features.

Standout: Filtering through the RUST_LOG variable

Pricing pointer

Free (open source), as listed by the vendor (env_logger website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Filtering through the RUST_LOG variable
  • Small dependency footprint

Drawbacks

  • Text output only, no file rotation
  • Limited structured output options

Skip it if this limit matters to you: text output only, no file rotation.

Verdict. A sensible pick for command-line tools and services configured by environment variables.

Alternatives in this guide: tracing, log, tracing-subscriber

04

tracing-subscriber

Best for teams using tracing that need filtering and formatted output

Visit github.com
tracing-subscriber homepage
tracing-subscriber homepage, captured Nov 2026

What it is and where it fits

tracing-subscriber is the companion crate that turns tracing events and spans into output. It provides the EnvFilter layer for environment-driven filtering, fmt layers for human-readable or JSON output, and support for composing multiple layers.

It is the usual backend for tracing users and runs wherever Rust runs. The crate is open source under MIT and maintained alongside tracing. It is not a standalone logger for the log facade, so projects built on log need a different backend. Large setups may need extra crates for file output or rotation.

Standout: EnvFilter supports RUST_LOG-style directives

Pricing pointer

Free (open source), as listed by the vendor (tracing-subscriber website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • EnvFilter supports RUST_LOG-style directives
  • Formatters for plain and JSON output

Drawbacks

  • Only works with the tracing facade
  • Configuration code can grow quickly

Skip it if this limit matters to you: only works with the tracing facade.

Verdict. A sensible pick for teams using tracing that need filtering and formatted output.

Alternatives in this guide: tracing, log, env_logger

05

slog

Best for applications that want structured, typed key-value logging

Visit github.com
slog homepage
slog homepage, captured Nov 2026

What it is and where it fits

slog is a structured logging library built around key-value pairs and a Drain abstraction that routes records to outputs. It emphasises typed fields and composable drains, so you can attach context and send records to several destinations.

It works on all major platforms and is open source under MIT or Apache-2.0. It does not depend on the log facade, so crates that log through log will not appear in slog output unless you bridge them. Choose it when structured data matters more than ecosystem breadth, and skip it for quick scripts.

Standout: Structured key-value records by design

Pricing pointer

Free (open source), as listed by the vendor (slog website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Structured key-value records by design
  • Drain system separates logging from output

Drawbacks

  • Steeper learning curve
  • Smaller ecosystem than log and tracing

Skip it if this limit matters to you: steeper learning curve.

Verdict. A sensible pick for applications that want structured, typed key-value logging.

Alternatives in this guide: tracing, log, env_logger

06

fern

Best for small applications that need custom output routing

Visit github.com
fern homepage
fern homepage, captured Nov 2026

What it is and where it fits

fern is a logging backend for the log facade. It offers a builder-style API for sending records to stdout, stderr, files or custom closures, and you can apply per-level or per-target filters.

It runs on all major platforms and is open source under MIT. It is a good fit when you want more control than env_logger but do not need the full configuration model of log4rs. It does not handle rotation or remote shipping by itself, and its release cadence is slower than the larger projects.

Standout: Simple builder API for chaining outputs

Pricing pointer

Free (open source), as listed by the vendor (fern website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Simple builder API for chaining outputs
  • Can route by level or target

Drawbacks

  • Less active than tracing and log tooling
  • No built-in file rotation

Skip it if this limit matters to you: less active than tracing and log tooling.

Verdict. A sensible pick for small applications that need custom output routing.

Alternatives in this guide: tracing, log, env_logger

07

log4rs

Best for services that need config-file driven logging and rotation

Visit github.com
log4rs homepage
log4rs homepage, captured Nov 2026

What it is and where it fits

log4rs is a configurable logging implementation for the log facade, modelled on log4j. You define appenders, encoders and loggers in a YAML or JSON file, or build them in code, and it handles file rotation and size limits.

It runs on all major platforms and is open source under MIT or Apache-2.0. It suits long-running services that want logging behaviour changed without a rebuild. It is heavier than env_logger and fern, so skip it for small command-line tools where an environment variable is enough.

Standout: YAML, JSON or builder configuration

Pricing pointer

Free (open source), as listed by the vendor (log4rs website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • YAML, JSON or builder configuration
  • Appenders with file rotation

Drawbacks

  • Configuration can be verbose
  • More setup than simple loggers

Skip it if this limit matters to you: configuration can be verbose.

Verdict. A sensible pick for services that need config-file driven logging and rotation.

Alternatives in this guide: tracing, log, env_logger

08

pretty_env_logger

Best for local development where readable terminal output helps

Visit github.com
pretty_env_logger homepage
pretty_env_logger homepage, captured Nov 2026

What it is and where it fits

pretty_env_logger is a small wrapper around env_logger that formats records with colors and aligned levels for terminal reading. It uses the same RUST_LOG filtering, so moving from env_logger is mostly a one-line change.

It runs on all major platforms and is open source under MIT or Apache-2.0. It is meant for development and debugging, not for machine-parsed production logs. If you need JSON or file output, use env_logger with a formatter or a different backend.

Standout: Colored, aligned output for terminals

Pricing pointer

Free (open source), as listed by the vendor (pretty_env_logger website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Colored, aligned output for terminals
  • Same RUST_LOG filtering as env_logger

Drawbacks

  • Not intended for production log pipelines
  • Adds a styling dependency

Skip it if this limit matters to you: not intended for production log pipelines.

Verdict. A sensible pick for local development where readable terminal output helps.

Alternatives in this guide: tracing, log, env_logger

Who should use what

If you are building an async web service on tokio, start with tracing and tracing-subscriber for spans and structured events. If you maintain a library, log lets you emit records without choosing a backend for your users. If you are writing a command-line tool, env_logger or pretty_env_logger gives you RUST_LOG filtering with little setup. If you run a long-lived service that needs config files and rotating log files, log4rs or fern fits better than the simple loggers.

Questions to settle before you buy

What to check before you buy

  • Decide whether you need a facade (log or tracing) or a full backend, and avoid mixing two facades.
  • Check that the backend supports the output you need: stdout, files, rotation or JSON.
  • Confirm the licence matches your project, since most crates here are MIT or Apache-2.0.
  • Review how filtering is configured, especially in containers and CI where environment variables are set per run.
  • Check the repository for recent releases and open issues before adopting a smaller crate.

FAQ

What is the difference between log and tracing?

log is a minimal facade with level-based macros and a Log trait. tracing adds spans and structured fields, which help follow work across async tasks. tracing can also emit log records through a compatibility layer, so the two can coexist. New async projects usually pick tracing; libraries often depend on log for wider compatibility.

Do I need both a facade and a logger?

Yes, if you use log or tracing. The facade defines the macros your code calls, and a backend such as env_logger, fern or tracing-subscriber decides where records go. Without a backend, records are dropped. Some crates bundle both roles, but the facade-plus-backend split is the common pattern.

Can these libraries write logs to a file?

env_logger writes to stderr by default. log4rs and fern can write to files, and log4rs adds rotation. tracing-subscriber can write to files through its writer options, and rolling-file crates add rotation. Check each project's documentation for the exact configuration.

Are these logging libraries free?

All the libraries in this guide are open source and free to use. Most are dual-licensed under MIT and Apache-2.0. You pay nothing for the crates themselves, but you are responsible for operating any log storage or aggregation service you send records to.

Should I log sensitive data in Rust applications?

No. Logs often leave the machine through collectors or files with broad read access. Avoid writing tokens, passwords and personal data at info level, and filter fields before they reach a backend. This matters most in production, where log retention and access rules apply.

Sources we checked

Method: how we score · editorial policy.

  1. tracing-subscriber (official site)
  2. log (official site)
  3. pretty_env_logger (official site)
  4. tracing-subscriber (official site)
  5. slog (official site)
  6. fern (official site)
  7. log4rs (official site)
  8. pretty_env_logger (official site)

Change log. First published 27 Nov 2026.