Hi guys, I have tried various logging approaches, in web2py, but no luck. 
Basically I create a module called logger.py:

#!/usr/bin/env python
# coding: utf8
from gluon import *
def get_configured_logger(name):
    logger = logging.getLogger(name)
    if (len(logger.handlers) == 0):
        # This logger has no handlers, so we can assume it hasn't yet been 
configured.
        # (Configure logger)
        return logger
        
# Assign application logger to a global var  
logger = get_configured_logger(request.application)


Problem is (obviously) 'request' is not defined. So the following code in 
my controller will simply not work:

LOGGER = logger.get_configured_logger('bmm_logging')

Please advise as the same issue occurs with cache.ram statements: 'cache' 
is not defined

Am I missing imports or what because these examples are everywhere, but the 
errors seem glaringly obvious.

All I want is to configure one single instance at the app level and use it 
globally.

thanks

ed


On Tuesday, 8 May 2012 01:58:27 UTC+2, rochacbruno wrote:
>
> you have a typo. it is response insted of reponse
>
> http://zerp.ly/rochacbruno
> Em 07/05/2012 20:55, "Tony Ha" <tony...@googlemail.com <javascript:>> 
> escreveu:
>
>> Hello,
>> Please help!
>> I am following the book "http://web2py.com/books"; on chapter overview, 
>> doing the mywiki app. after append the def news(): codes into the default 
>> controller: then I visit http://127.0.0.1:8000/mywiki/default/news.rss 
>> and I got 
>> Internal errorTicket issued: 
>> mywiki/127.0.0.1.2012-05-07.20-19-57.d577cc7e-d59e-45f7-87f5-50551b75313c<http://127.0.0.1:8000/admin/default/ticket/mywiki/127.0.0.1.2012-05-07.20-19-57.d577cc7e-d59e-45f7-87f5-50551b75313c>
>>  
>> when I open this ticket it say
>> <type 'exceptions.NameError'> global name 'reponse' is not defined
>>
>> Do I need to import any python module to solve this issue? 
>>
>> Many thanks for the help!
>>
>> Tony.
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to