How does one make logging color in Django/Google App Engine?


If one iswriting a Django/ Google App Engine application and would like to have logs that are conveniently conspicuous based on color (i.e. errors in red), how does one set that up?

I’ve copied the helpful solution from this question, but I’m not sure how to integrate it into Django/Google App Engine.

I figured one would put the following in the application’s (i.e. essentially from the example here: Running Django on Google App Engine):

from contrib.utils import ColouredLogger # from the SO question above

… where contrib.utils is where I put airmind’s code from the above link to his SO answer.

However, that doesn’t seem to do anything to the output to the console for GAE, which continues to be in the original format + plain color.

Suggestions and input would be much appreciated.



We use colorlog and it does exactly what you expect.

For posterity, the formatter config we use is:

'color': {
    '()': 'colorlog.ColoredFormatter',
    'format': '%(log_color)s%(levelname)-8s %(message)s',
    'log_colors': {
        'DEBUG':    'bold_black',
        'INFO':     'white',
        'WARNING':  'yellow',
        'ERROR':    'red',
        'CRITICAL': 'bold_red',

Answered By – Alec Thomas

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published