AlterEgo
old web2py blog
Useful Links
List all entries
Book
Interactive Examples
F.A.Q.
Free Applications
Plugins
Recipes
Demo of Admin Interface
Semantic web extension
Some of the information here may be outdated, please check the book instead
Edit page
Title:
Security Code:
Body:
(use
this
wiki markup)
By default web2py stores tickets (errors) on the local file system. This is because most of the tickets are caused by database failures. Anyway You can move the tickets to a database by creating a script like: import os, time, stat, datetime from gluon.restricted import RestrictedErro() db=SQLDB('postgres....') db.define_table('ticket', SQLField('name'), SQLField('date_saved','datetime'), SQLField('layer'), SQLField('traceback','text'), SQLField('code','text')) path='applications/yourapp/errors/' while 1: for file in os.listdit(path): e=RestrictedError() e.load(path+file) t=datetime.fromtimestamp(os.stat(path+file)[stat.ST_MTIME]) db.ticket.insert(date_saved=t,name=file,layer=e.layer,traceback=e.traceback,code=e.code) os.unlink(path+file) db.commit() time.sleep(300) and run it with python web2py.py -S yourapp -M -R yourscript.py This is just an example. No concurrency problems because tickets would always be stored locally and in db moved every 5 minutes. This solution decauples the problem of storing a ticket in case of database failure from your app that would create meta-tickets
© 2008-2010 by Massimo Di Pierro - All rights reserved - Powered by
web2py
- design derived from a theme by
the earlybird
The content of this book is released under the
Artistic License 2.0
- Modified content cannot be reproduced.