Glad you like- I'd love to see this as part of the core. Let me know if
there's anything else I can do.
>I am not so keen to include the sqlite part because it is too specific
Is this because it requires the extra module? I kept it separate because
it's a Python, not web2py, specific class, but we could easily bake it into
log.py.
Personally I'm a big fan of SQLite for logging- what would it take to make
it less specific and ready for inclusion?
>we would need a way to deal with GAE/
Hans/Iceberg had a GAE solution in their orig file, but I haven't tested it:
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
else:
handler=logging.handlers.RotatingFileHandler(os.path.join(request.folder,filename),maxBytes=maxBytes,backupCount=backupCount)
I'll re-introduce it into the code though.
On Fri, Jul 23, 2010 at 9:38 AM, Massimo Di Pierro
<[email protected]>wrote:
> Very good work. We should think about a way to include this in web2py core.
>
> 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/
>
>
> On Jul 23, 2010, at 8:24 AM, Yarin wrote:
>
> Added a slice: Application Logging
>> http://web2pyslices.com/main/slices/take_slice/91
>>
>> It covers logging to both a file and SQLite. The code is well
>> documented- use this instead of the previous code. Would love to get
>> your comments.
>>
>> @Iceberg, btw apparently the SQLite cross-thread issues weren't solved
>> by using the default DB after all. I added a thread-safe work around,
>> but suggestions are welcome.
>>
>> On Jul 22, 8:20 am, Massimo Di Pierro <[email protected]> wrote:
>>
>>> This is useful. I suggest making a web2py slice about this.
>>>
>>> Massimo
>>>
>>> On Jul 21, 2010, at 9:37 PM, Iceberg 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?
>>>>>
>>>>
>