-
Notifications
You must be signed in to change notification settings - Fork 721
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
Is it possible to use tracing with a different logger? #1237
Comments
@iptq did you ever find a solution for this issue? I'm using fern in a project as well and running into issues with tracing. |
To me, it looks like |
Thanks @notgull ! I created this repo to try to get things to work and I get the error
is the |
In the repo above, it looks like you initialize a |
Thank you @notgull, it works without the |
Yes. Tracing subscribers put an object in the global log dispatch that redirects log events to tracing. Consider adding the |
Thanks @notgull, this really helps! I'll have to experiment with it a little as I learn more about each library. I got it working a little with removing |
Following up: I think we can safely close this issue as To build off https://github.com/cdesch/macro_sandbox/blob/workaround-ish/src/main.rs, it'd be possible to write to a file using the approach in https://github.com/tokio-rs/tracing/blob/v0.1.x/examples/examples/fmt-multiple-writers.rs. Feel free to open a discussion if you'd like this approach to be elaborated on. |
I'm currently using fern, and it seems that I can't have both fern and tracing-subscriber since they're both in some kind of global subscriber slot. I prefer fern since it's already hooked up to my command-line options and most importantly, lets me write to a file, a feature that I've seen asked about in multiple different issues with no clear resolution. Since I'm developing an application that runs a raw-mode TUI, it's very important that all my logs go to a different file rather than stdout or stderr.
I figured that since the subscriber is global, would it be possible for me to have tracing send events to whatever the log crate usually sends to as well?
The text was updated successfully, but these errors were encountered: