Python/Django debug logs show up as Errors in GAE logs

112 views
Skip to first unread message

Matti Dahlbom

unread,
Jun 1, 2016, 4:46:13 AM6/1/16
to Google App Engine
I was wondering what am I doing wrong since all my (debug) logs from my Python/Django app under GAE appears as Errors in the GAE logs? 

My Django logging setup is:

LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'formatters': {
        'verbose': {
            'format': '[%(asctime)s] %(levelname)s <%(name)s>: %(message)s',
            },
        'simple': {
            'format': '[%(asctime)s] [%(name)s] [%(levelname)s] %(message)s'
            },
        },
    'filters': {
        },
    'handlers': {
        'null': {
            'level': 'DEBUG',
            'class': 'django.utils.log.NullHandler',
            },
        'console':{
            'level':'DEBUG',
            'class':'logging.StreamHandler',
            'formatter': 'simple'
            },
        'mail_admins': {
            'level': 'ERROR',
            'class': 'django.utils.log.AdminEmailHandler',
            'filters': []
            }
        },
    'loggers': {
        'django': {
            'handlers':['console'],
            'propagate': True,
            'level':'INFO',
            },
        'vision-api-poc': {
            'handlers':['console'],
            'propagate': False,
            'level':'DEBUG',
            },
        }
}


And this is how I'm using the logging interface:

import logging
log = logging.getLogger("vision-api-poc")

log.debug("Image size after resize: %s" % unicode(im.size))

And this is how it looks like in the GAE logs (the two exclamation marks + orange bg is an Error according to the browser mouseover):


Is this normal? Should I bypass the django logging setup and just use logging.debug("foo") directly?

- Matti

Nick (Cloud Platform Support)

unread,
Jun 2, 2016, 3:14:18 PM6/2/16
to Google App Engine
Hey Matti,

Could you upload the image again? It doesn't seem to be loading for me on my end. I tested whether debug logs would show up as [!!] in a simple python app, and they didn't, so either something in your app is transforming the django debug logs to error logs, or something else more strange is going on. We'll be able to investigate if you show a screenshot of the *expanded* log in the Logs Viewer. 

Cheers,

Nick
Cloud Platform Community Support

Matti Dahlbom

unread,
Jun 3, 2016, 12:10:31 AM6/3/16
to Google App Engine


On Thursday, June 2, 2016 at 10:14:18 PM UTC+3, Nick (Cloud Platform Support) wrote:
Could you upload the image again? It doesn't seem to be loading for me on my end. I tested whether debug logs would show up as [!!] in a simple python app, and they didn't, so either something in your app is transforming the django debug logs to error logs, or something else more strange is going on. We'll be able to investigate if you show a screenshot of the *expanded* log in the Logs Viewer. 


Certainly.. lets try with another, this one is from a full log entry for one request.



 Could the problem be the usual extra crap the logging setup adds (timestamp, [LOGLEVEL], etc.)?

- Matti

Nick (Cloud Platform Support)

unread,
Jun 10, 2016, 4:28:07 PM6/10/16
to Google App Engine
I've reproduced the issue you saw, although I've been attempting to determine its root cause. The standard logger (logging.getLogger()) seems to work properly for calls to debug().

My first intuition was that this might have to do with the way our system collects logs from the standard logger vs how the Django logging system is outputting its logs. We'll update this thread shortly as we look into the root cause of this difference.

Sincerely,


Nick
Cloud Platform Community Support

Zeehad (Cloud Platform Support)

unread,
Jun 17, 2016, 1:02:27 PM6/17/16
to Google App Engine
Hello Matti,

Thank you for bringing this to our attention. Your report has been forwarded to the engineering team and any questions they have will be posted in the related issue tracker. Further status updates will be posted there as well.

I recommend you star the issue in order to receive automatic updates.

Cheers!
Reply all
Reply to author
Forward
0 new messages