emabee / flexi_logger

A flexible logger for rust programs that can write to stderr, stdout, and/or to log files
Apache License 2.0
307 stars 50 forks source link

[Question] write to console first then log to file #118

Closed thaodt closed 2 years ago

thaodt commented 2 years ago

Hi, is there a way to log to stdout/err from the first place and reconfigure to log to file later (from the another place - by reading application configuration)?

I tried some available configuration from docs, but no matter what I tried, it logged to the file.

emabee commented 2 years ago

Sorry, that's currently not possible.

emabee commented 2 years ago

Not completely correct ;-) See https://docs.rs/flexi_logger/0.23.1/flexi_logger/code_examples/index.html#reconfigure-the-file-log-writer for an example of how to change the output file. You cannot start without one, but you could try /dev/null or a dummy file.