On Aug31, 8:48pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > Thanks for this is email. It is good to have some clear points to be > able to reply to. > > On Aug 29, 6:15 pm, Scott Hunter <shun...@nycap.rr.com> wrote: > > > Complaint #2: No proper logging mechanism for modules. (Related: > > web2py is pathetic at third-party module integration) > > Response #2: Again, nothing in web2py precludes using python's logging > > facility. (And I've had no problem getting it to play nice with PIL > > and some other modules, so I'm not sure what the complaint is here.) > > In Python like Java and like an other languages there is a "import" > mechanism for third party modules. web2py uses the standard python > mechanism and you can use ANY third party module. In particular you > can use the logging module. Some people do not like to use the logging > module because they run multiple appliances and they want a log per- > appliances and not a log per-web2py-instance. This is also possible > and there is a thread here in which multiple solutions have been > proposed. I am having problems finding the thread today but we'll open > another one when I find it.
Hi Massimo, if you don't mind, I suggest to put following code into applications/welcome/models/log.py so that it becomes a live example from out-of-box web2py. Iceberg def _init_log(): import logging,os,logging.handlers logger=logging.getLogger(request.application) logger.setLevel(logging.DEBUG) handler=logging.handlers.RotatingFileHandler( os.path.join(request.folder,'app.log'),'a',1024*1024,1) handler.setLevel(logging.DEBUG) handler.setFormatter(logging.Formatter( "%(asctime)s %(levelname)s %(funcName)s():%(lineno)d %(message) s")) logger.addHandler(handler) return logger logging=cache.ram('app_wide_log',lambda:_init_log(),time_expire=None) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---