Best regards,
Iceberg, 2010-Jul-22, 10:28(AM), Thu
----------------------- Original Message -----------------------
From: Yarin <ykes...@gmail.com>
To: web2py-users <web...@googlegroups.com>
Cc: johann.sch...@easytouch-edv.com, mdip...@cs.depaul.edu, ice...@21cn.com
Date: Wed, 21 Jul 2010 19:15:55 -0700 (PDT)
Subject: SQLite Logging
-------------------
Massimo
I am not so keen to include the sqlite part because it is too specific
but:
I see the log.py file could go in contrib with minimal changes (it it
were implemented as a function that takes the request and cache objects)
we would need a way to deal with GAE/
1. Change those time_expire=99999999 into time_expire=None please. The clumsy 99999999 trick was my early "invention" before I know the time_expire=None approach.
2. My another later improvement is to write the log file at {web2py path}/applications/{your app}/static/app.log
so that developer can easily access the log file by http://your_host/your_app/static/app.log
Well, you can refer to the attachment for my latest implementation. Some more trick inside.
3. @Massimo, I suggested to include the applog.py into welcome/model/applog.py since day1 I invented this little component. Only this way people will have an official place to always have the latest code, rather than dig some not-the-latest post from different places. So please do consider it this time.
4. @Yarin, when last time I said "putting the web2py db instance, rather than a filename, to initialize your SQLiteHandler() class", I mean something like:
def _init_sqlite_log(level=logging.DEBUG):
handler = SQLiteHandler( db ) # db is defined by: db = DAL('sqlite://storage.sqlite')
# or
handler = SQLiteHandler( DAL('sqlite://log.sqlite') )
There is some more implementation to do, but you get the idea.
5. With respect to GAE, this was my "concept vehicle":
if request.env.web2py_runtime_gae: # if running on Google App Engine
handler=logging.handlers.HTTPHandler(request.env.http_host,URL(r=request,f='log'))
# assuming there is an optional log action
but I never test it. I think a practical solution would be implement some log handler which wraps GAE's own log facility.
Best regards,
Iceberg, 2010-Jul-24, 02:35(AM), Sat
----------------------- Original Message -----------------------
From: Yarin Kessler <ykes...@gmail.com>
To: Massimo Di Pierro <mdip...@cs.depaul.edu>
Cc: web2py-users <web...@googlegroups.com>, Iceberg <ice...@21cn.com>, Hans <johann.sch...@easytouch-edv.com>, Richard <rich...@gmail.com>, MikeEllis <michael...@gmail.com>, cjparsons <cjpar...@yahoo.co.uk>
Date: Fri, 23 Jul 2010 09:56:17 -0400
Subject: Re: SQLite Logging
-------------------