tokio-rs / tracing

Application level tracing for Rust.
https://tracing.rs
MIT License
5.39k stars 707 forks source link

multiple app instances, same log file #2919

Closed estnml closed 4 months ago

estnml commented 6 months ago

Feature Request

ability to log events to same file coming from multiple instances of the application.

Crates

Motivation

sometimes the application we wrote (e.g. webapi written in axum) work as multiple instances in the server. It would be great if we could configure the tracing behaviour to same log file or log files for each instance.

Proposal

Alternatives

mladedav commented 5 months ago

Writing from multiple processes to the same file would involve some inter-process synchronization which I don't think should be handled by tracing.

Personally, I do believe your best course of action would be to either use a file per instance or something designed for this kind of thing like journald.

davidbarsky commented 4 months ago

yeah, you'd want something like journald here.