By using web2py's default sqlite db, I was able to solve the threading issues- however, for whatever reason the only record being inserted into the db is the initial one from log.py when logging gets initiated. Any subsequent attempts to log from controllers don't show up in the db- no error, just nothing, even though the same code pointing to a file works fine. I'm really at a loss here- I've linked to the application archive, if anyone would be willing to take a look:
https://sites.google.com/site/ykessler/main/logging_sqlite_test.tar The relevant files are models/log.py and models/sqlhandler.py. I'm running this with mod_wsgi/apache. Any ideas would be welcome. On Jul 22, 12:07 am, Yarin <[email protected]> wrote: > Disregard that last post I found it: web2py/applications/{app}/ > databases/storage.sqlite > I used that and looks like it solved the threading issues! Thanks > Iceberg... testing now to see if I can get the whole thing working... > > On Jul 21, 11:41 pm, Yarin <[email protected]> wrote: > > > > > @Iceberg, that seems like a really good idea but I'm not sure how I'm > > supposed to do that- what is the 'web2py db instance'? An instance of > > what? Or is it a path to a db file that already exists in the web2py > > heirarchy? Could you possibly provide an example? > > > Thanks-- > > > On Jul 21, 10:37 pm, Iceberg <[email protected]> wrote: > > > > Just a quick thought. Since web2py itself already handles SQLite db well > > > under multi-thread situation, so a quick tweak to your sqlitehandler.py > > > may be putting the web2py db instance, rather than a filename, to > > > initialize your SQLiteHandler() class. > > > > Best regards, > > > Iceberg, 2010-Jul-22, 10:28(AM), Thu > > > > ----------------------- Original Message ----------------------- > > > From: Yarin <[email protected]> > > > To: web2py-users <[email protected]> > > > > Cc: [email protected], [email protected], > > > [email protected] > > > Date: Wed, 21 Jul 2010 19:15:55 -0700 (PDT) > > > Subject: SQLite Logging > > > ------------------- > > > > > I'd like to elicit some help in putting together a SQLite-based > > > > logging solution for web2py. > > > > > Logging to a file was covered earlier in this forum (See "Global > > > > logging to file"): > > > >http://groups.google.com/group/web2py/browse_thread/thread/e20d0bd2e5... > > > > log.py: > > > >https://sites.google.com/site/ykessler/main/log.py > > > > > I've written a SQLite logging handler: > > > >https://sites.google.com/site/ykessler/main/sqlitehandler.py > > > > > However, although the SQLite handler works great in normal Python > > > > environments, it errors out with the global logging solution because > > > > the logger emits on multiple threads, and SQLite objects are > > > > restricted to the thread they're created on. > > > > > Any ideas on how to sync these two solutions?

