Python Colorlog Not Printing In The Log Files With Colors
Solution 1:
The colored output used by colorlog and most other terminal coloring libraries changes properties of the user terminal, through the shell's escape sequences.
In practice, this will print shell escape sequences which are not human readable, such as \[\033[34m\]
. Your shell is responsible for parsing these sequences into colors on your display.
A plain text file does not support color information encoded into it, so generally when writing to files, all logging tools will turn off the color support, or else you would get mangled text in your log files. Just think of a plain text file packed with those unreadable escape sequences everywhere.
For more information on shell coloring and escape sequences you can take a look at http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html (bash specific, similar on other shells)
Post a Comment for "Python Colorlog Not Printing In The Log Files With Colors"