Skip to content

fix: point appender symlink to correct target#3573

Open
aurelj wants to merge 1 commit into
tokio-rs:mainfrom
aurelj:symlink_fix
Open

fix: point appender symlink to correct target#3573
aurelj wants to merge 1 commit into
tokio-rs:mainfrom
aurelj:symlink_fix

Conversation

@aurelj

@aurelj aurelj commented Jun 30, 2026

Copy link
Copy Markdown

The latest_symlink feature added to tracing-appender is creating a symlink pointing to an invalid target.

Here is a simple example that shows the issue:

use tracing_appender::rolling::{RollingFileAppender, Rotation};

fn main() {
    let file_appender = RollingFileAppender::builder()
        .rotation(Rotation::DAILY)
        .filename_prefix("myapp.log")
        .latest_symlink("myapp.log")
        .build("logs")
        .expect("initializing rolling file appender failed");

    tracing_subscriber::fmt().with_writer(file_appender).init();
}

and here is the resulting symlink:

$ cargo run
$ ls -l logs
lrwxrwxrwx 1 aurel aurel 25 30 juin  18:22 myapp.log -> logs/myapp.log.2026-06-30
-rw-rw-r-- 1 aurel aurel  0 30 juin  18:22 myapp.log.2026-06-30

Note that both the log file and the symlink are inside the logs directory but the symlink is pointing to logs/myapp.log.2026-06-30 instead of myapp.log.2026-06-30.

This patch fixes the issue and generate the proper symlink as shown here:

$ cargo run
$ ls -l logs
lrwxrwxrwx 1 aurel aurel 20 30 juin  18:24 myapp.log -> myapp.log.2026-06-30
-rw-rw-r-- 1 aurel aurel  0 30 juin  18:24 myapp.log.2026-06-30

@aurelj aurelj requested review from a team, hawkw and hds as code owners June 30, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant