Skip to content

Debugging

OXC_LOG Environment Variable

The OXC_LOG environment variable enables runtime tracing in oxlint and oxfmt. When not set, logging is completely disabled for zero-cost operation.

Basic Usage

bash
# Enable debug logging for oxlint
OXC_LOG=debug oxlint

# Enable debug logging for oxfmt
OXC_LOG=debug oxfmt

# Enable resolver tracing when using import plugin
OXC_LOG=oxc_resolver oxlint --import-plugin

# Enable formatter tracing
OXC_LOG=oxc_formatter oxfmt
``````bash
OXC_LOG=debug oxlint
OXC_LOG=debug oxfmt
``````bash
OXC_LOG=oxc_resolver=debug oxlint --import-plugin
``````toml Cargo.toml
[profile.release]
debug = true
strip = false
panic = "unwind"
``````bash
cargo build --release --bin oxlint --features allocator
``````bash
rust-lldb -- ./target/release/oxlint
``````json
{
  "type": "lldb",
  "request": "launch",
  "name": "Debug Oxlint",
  "cargo": {
    "env": {
      "RUSTFLAGS": "-g"
    },
    "args": ["build", "--bin=oxlint", "--package=oxlint"],
    "filter": {
      "name": "oxlint",
      "kind": "bin"
    }
  },
  "cwd": "PATH-TO-TEST-PROJECT", // [!code focus]
  "args": ["--ARGS-TO-OXLINT"] // [!code focus]
}