#3599·tracing

tracing-appender has broken symlinks when a relative path is specified

Author: SculasCreated Aug 16, 2026Updated Sep 10, 2026

Bug Report

Version

│   ├── tracing v0.1.44
│   │   ├── tracing-attributes v0.1.31 (proc-macro)
│   │   └── tracing-core v0.1.36
│   ├── tracing-appender v0.2.5
│   │   └── tracing-subscriber v0.3.23
│   │       ├── tracing-core v0.1.36 (*)
│   │       └── tracing-log v0.2.0
│   │           └── tracing-core v0.1.36 (*)
│   └── tracing-subscriber v0.3.23 (*)
└── tracing v0.1.44 (*)

Platform

Linux 7.1.8-1-cachyos SMP PREEMPT_DYNAMIC x86_64 GNU/Linux

Crates

tracing-appender v0.2.5

Description

When using the latest_symlink feature added in #3447, if a relative path is specified to Builder::build, the symlink also uses the relative path. This results in broken symlinks when a relative path to a directory is specified.

For example, this code:

rust
let appender = RollingFileAppender::builder()
    .rotation(Rotation::DAILY)
    .filename_prefix("myapp.log")
    .latest_symlink("latest.log")
    .build("./logs")
    .expect("failed to initialize rolling file appender");

Results in the symlink latest.log to point to ./logs/myapp.log.2019-01-01 while itself already inside of the logs directory, so it actually points to ./logs/./logs/myapp.log.2019-01-01, which is invalid.

The workaround is to always specify an absolute path to Builder::build. But this should be fixed by providing the correct path to symlink::symlink_file (either absolute, or fixing the relative path so it's correct): https://github.com/tokio-rs/tracing/blob/d9d4c542de10f5d3a711b7a45ffe450fd0666437/tracing-appender/src/rolling.rs#L802-L808