I\'m using PyCharm to develop a GAE app in Mac OS X. Is there any way to display colours in the run console of PyCharm?
I\'ve set a handler to output colours in ansi
Sept. 2019: PyCharm Community 2019.1
PyCharm colored all the logs including info/debug in red.
Th upshot is: it is not a PyCharm problem, this is how the default logging is configured.
Everything written to sys.stderr is colored red by PyCharm.
When using StreamHandler() without arguments, the default stream is sys.stderr.
For getting non-colored logs back, specify logging.StreamHandler(stream=sys.stdout) in basic config like this:
logging.basicConfig(
level=logging.DEBUG,
format='[%(levelname)8s]: %(message)s',
handlers=[
logging.FileHandler(f'{os.path.basename(__file__)}.log'),
logging.StreamHandler(sys.stdout),
])
or be more verbose:
logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
This fixed my red PyCharm logs.