Hey, 
I ran into a problem. I was trying to do logging in my web2py application.
I did the following for the same( referred to some article on internet)

Add following codes inside model/log.py:

  def _init_log():
    import logging
    logger=logging.getLogger(request.application)
    logger.setLevel(logging.DEBUG)
    handler=logging.FileHandler("%s.log"%request.application)
    handler.setLevel(logging.DEBUG)
    handler.setFormatter(logging.Formatter(
      "%(levelname)s %(asctime)s %(funcName)s %(lineno)d %(message)
s"))
    logger.addHandler(handler)
    return logger
  logging=cache.ram('once',lambda:_init_log(),time_expire=99999999)

now, since logging does not work in modules, I will have to use lazy_lazy_cache 
in my looging.py

Now how can I access the |logging| object ( or equivalent) in my controller? I 
want to do logging. I was supposed to do |logging.warn('bla')|, but problem is 
that with lazy_lazy_cache, |logging| is not defined.



On Thursday, July 26, 2012 4:22:32 AM UTC+5:30, Anthony wrote:
>
> I am ok with renaming lazy_cache (although some people will ask, isn't the 
>> cache lazy already by definition?). We cannot call it current_cache because 
>> it is not current.cache and that would cause confusion. It is a lazy 
>> current.cache.
>>
>
> I was thinking current_cache because it's a decorator that uses 
> current.cache. We can use current.cache in a module, but we can't decorate 
> with @current.cache, so I was thinking the next closest thing would be 
> @current_cache (which uses current.cache internally anyway).
>
> Anthony
>

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to