2007年11月07日 星期三 09:29
²¿ÊðÔÚ·þÎñÆ÷ÉÏÓõÄÊÇfastcgi·½Ê½£¬ÒÔǰûÓÐ404£¬500Ò³ÃæÊ±£¬¿ÉÒÔ¿´µ½´íÎóµÄÈÕÖ¾£¬ ÏÖÔÚ¼ÓÉÏÁË404£¬500Ò³Ãæ£¬´íÎóÈÕ־ȴ¿´²»µ½ÁË¡£ÓÉÓÚ²¿Êðproduction»·¾³Ï£¬DEBUG²»·½±ã´ò¿ª -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20071107/485f75f1/attachment.htm
2007年11月09日 星期五 15:53
自己顶一下,参考djangosnippets.org上的,用一个middleware解决了 On Nov 7, 2007 9:29 AM, leopay <leopay在gmail.com> wrote: > 部署在服务器上用的是fastcgi方式,以前没有404,500页面时,可以看到错误的日志, > 现在加上了404,500页面,错误日志却看不到了。由于部署production环境下,DEBUG不方便打开
2007年11月09日 星期五 15:56
½¨Òé¹²Ïí½â¾ö·½°¸¡£²»ÒªÒ»¸ö½â¾öÁ˾Í×ßÈËѽ £º£© ÔÚ07-11-9£¬leopay <leopay在gmail.com> дµÀ£º > > ×Ô¼º¶¥Ò»Ï£¬²Î¿¼djangosnippets.orgÉϵģ¬ÓÃÒ»¸ömiddleware½â¾öÁË > > On Nov 7, 2007 9:29 AM, leopay <leopay在gmail.com> wrote: > > ²¿ÊðÔÚ·þÎñÆ÷ÉÏÓõÄÊÇfastcgi·½Ê½£¬ÒÔǰûÓÐ404£¬500Ò³ÃæÊ±£¬¿ÉÒÔ¿´µ½´íÎóµÄÈÕÖ¾£¬ > > ÏÖÔÚ¼ÓÉÏÁË404£¬500Ò³Ãæ£¬´íÎóÈÕ־ȴ¿´²»µ½ÁË¡£ÓÉÓÚ²¿Êðproduction»·¾³Ï£¬DEBUG²»·½±ã´ò¿ª > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese -- site:http://www.fallever.com -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20071109/44ea692e/attachment.htm
2007年11月12日 星期一 10:42
#coding: utf-8
#logging_middleware.py
import traceback
import sys
import time
from django.conf import settings
class LoggingMiddleware(object):
def process_exception(self, request, exception):
exc_info = sys.exc_info()
exc_info_str='\n'.join(traceback.format_exception(*(exc_info or
sys.exc_info())))
fp=open(settings.LOGGINGFILE,'ab+')
fp.write('[%s] request from %s\n%s\n'%(time.ctime(),
request.get_full_path(),exc_info_str))
fp.close()
ÔÚsettings.pyÖеÄMIDDLEWARE_CLASSES¼ÓÉϸölogging_middleware¼´¿É
On 11/9/07, jeff jie <bbmyth在gmail.com> wrote:
>
> ½¨Òé¹²Ïí½â¾ö·½°¸¡£²»ÒªÒ»¸ö½â¾öÁ˾Í×ßÈËѽ £º£©
>
> ÔÚ07-11-9£¬leopay <leopay在gmail.com> дµÀ£º
> >
> > ×Ô¼º¶¥Ò»Ï£¬²Î¿¼djangosnippets.orgÉϵģ¬ÓÃÒ»¸ömiddleware½â¾öÁË
> >
> > On Nov 7, 2007 9:29 AM, leopay <leopay在gmail.com> wrote:
> > > ²¿ÊðÔÚ·þÎñÆ÷ÉÏÓõÄÊÇfastcgi·½Ê½£¬ÒÔǰûÓÐ404£¬500Ò³ÃæÊ±£¬¿ÉÒÔ¿´µ½´íÎóµÄÈÕÖ¾£¬
> > > ÏÖÔÚ¼ÓÉÏÁË404£¬500Ò³Ãæ£¬´íÎóÈÕ־ȴ¿´²»µ½ÁË¡£ÓÉÓÚ²¿Êðproduction»·¾³Ï£¬DEBUG²»·½±ã´ò¿ª
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
>
>
> --
> site:http://www.fallever.com
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071112/c725c279/attachment.htm
Zeuux © 2025
京ICP备05028076号