Tracing crate Logged file has unreadable and sufficient characters compared to STDOUT

When making a log to a file I got different data compared to the STDOUT log. There are some extra characters that I think represents some text formatting. Which text editor should be used for log file opening?

Below you can see the log from the file and from STDOUT.

�[2mFeb 20 23:05:29.707�[0m �[32m INFO�[0m �[1;32mmac_rx::mac�[0m�[32m: �[32mWe are logging string., �[1;32mstring_log�[0m�[32m: Test String!�[0m �[2;3mat�[0m mac/mac_rx/src/�[2;3m �[0m

Feb 20 23:05:56.948 INFO mac_rx::mac: We are logging string., string_log: Test String! at mac/mac_rx/src/

Found the issue, configuration .with_ansi(false) needs to be added in tracing_subscriber::fmt().

It would be nice if it can be described in documentation

Those weird characters are called ANSI escape sequence. Your terminal recognize it to make certain parts of your logs colored. If you cat the file instead of opening it in your editor you may see your normal logs with color.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.