Skip to content

tracing_appender did not work as global? #2210

Answered by davidbarsky
xuanwa asked this question in Q&A
Discussion options

You must be logged in to vote

You're currently dropping tracing_appender's _guard at the end of log_init. Instead, it must be returned from the log_init function to fn main (or whatever function lives as long as the program does), as dropping the guard will close the file writer. For additional details, see the documentation on WorkerGuard. Once you do that, you should see things logged to the file.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@xuanwa
Comment options

Answer selected by davidbarsky
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants