V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
pc10201
V2EX  ›  Python

如果将 scrapy 的错误日志直接存入到 mysql 中?

  •  
  •   pc10201 · 2014-10-08 11:25:44 +08:00 · 3838 次点击
    这是一个创建于 3459 天前的主题,其中的信息可能已经有所发展或是发生改变。
    scrapy可以将日志存到一个文件当中,不过好像不太方便分析,因为有许多错误原因是相同的,然后反复往里面写,看起来比较累,我想直接写到数据库中方便分析一些

    我试了一下,在pipelines.py中直接写数据库语言好像不起作用
    开发环境是win7,python最新版32位,scrapy最新版
    2 条回复    2014-10-31 11:51:18 +08:00
    Codist
        1
    Codist  
       2014-10-08 13:40:26 +08:00
    没有碰见过直接入库的日志模块,日志入库一般是写脚本扫描日志文件吧,日志文件分析蛮方便的。不知道在win下是什么感受。这种需求重新实现scrapy的log模块么。
    Melodic
        2
    Melodic  
       2014-10-31 11:51:18 +08:00
    可以考虑自己写个Middleware来处理,log也在middleware中记录
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1001 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 22:18 · PVG 06:18 · LAX 15:18 · JFK 18:18
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.