PyCharm logging output colours

As of at least PyCharm 2017.2 you can do this by enabling:

Run | Edit Configurations... | Configuration | Emulate terminal in output console

Run configuration

enter image description here


Late to the party, but anyone else with this issue, here's the solution that worked for me:

import logging
import sys
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)

This came from this answer


PyCharm doesn't support that feature natively, however you can download the Grep Console plugin and set the colors as you like.

Here's a screenshot: http://plugins.jetbrains.com/files/7125/screenshot_14104.png (link is dead)

I hope it helps somewhat :) although it doesn't provide fully colorized console, but it's a step towards it.


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.