开发者

Errors being logged for only HTTP and not HTTPS but the response is 200?

开发者 https://www.devze.com 2023-01-25 16:13 出处:网络
I\'ve just deployed an app to App Engine and everything is working great. I\'m using Django 1.1. I\'ve got a page that returns some JSON/JSONP data. Everything works great but my logs are filling up

I've just deployed an app to App Engine and everything is working great. I'm using Django 1.1.

I've got a page that returns some JSON/JSONP data. Everything works great but my logs are filling up with errors that have no real information in them. I'm ONLY getting these errors when accessing the app using HTTP, NO ERRORS when it's HTTPS.

The client still receives a 200 and the data is returned fine either way. It's just that App Engine is logging an error when the request is HTTP. The errors that are logged all look like the following.

+ 11-16 01:02PM 2开发者_高级运维0.181 /some/url?jsonp=1231234344 200 16ms 8cpu_ms 8api_cpu_ms 0kb....
  E 11-16 01:02PM 20.196
  E 11-16 01:02PM 20.197
  E 11-16 01:02PM 20.197 www.myapplicationname.appspot.com |1| www.myapp
  E 11-16 01:02PM 20.197

What does that mean? why does everything work great, but I always get these logs for non-ssl pages only?

update: This is the only logging reference I have in my code that would involve the route causing the error. It's in my main.py

#import logging, os
import os

# Must set this env var before importing any part of Django
os.environ['DJANGO_SETTINGS_MODULE'] = 'stampinstats.settings'

# django 1.1 is setup here to avoid conficts with default 0.96
import appengine_config

# Force Django to reload its settings
from django.conf import settings
settings._target = None

import logging
import django.core.handlers.wsgi
import django.db

# Google App Engine imports
from google.appengine.ext.webapp import util

def log_exception(sender, **kwargs):
    logging.exception('Exception in request:')

sig = django.dispatch.Signal()
sig.connect(log_exception)
sig.disconnect(django.db._rollback_on_exception)

def main():
    # Create a Django application for WSGI
    application = django.core.handlers.wsgi.WSGIHandler()

    # Run the WSGI CGI handler with the application
    util.run_wsgi_app(application)

if __name__ == '__main__':
    main()

Thanks


Is something in your code calling logging.error()?

0

精彩评论

暂无评论...
验证码 换一张
取 消