Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple app instances, same log file #2919

Open
estnml opened this issue Mar 30, 2024 · 1 comment
Open

multiple app instances, same log file #2919

estnml opened this issue Mar 30, 2024 · 1 comment

Comments

@estnml
Copy link

estnml commented Mar 30, 2024

Feature Request

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

Crates

  • tracing
  • tracing-subscriber
  • tracing-appender

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

  • different log file for every instance. (however i couldnt figure out how to configure it tracing-appender)
    • using RollingFileAppender::builder().filename_prefix(log_file_prefix) and
    • let log_file_prefix = format!("instance_{args.port}_backend");
@mladedav
Copy link
Contributor

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.

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

No branches or pull requests

2 participants