I happened to be the creator of that code snippet. :-) Glad to know that it helps you.
But I would recommend you use a later version, quoted already in Omicron's post. It uses RotatingFileHandler to avoid unstoppable log file size, and it serves the log by http://yourhost/yourapp/static/applog.txt. And the only downside (of both version) is that it does not work on GAE (yet?). A simple workaround might be turn it off when "if running_on_gae==True". Besides, I once suggested Massimo to include it inside the scaffolding app, but no agreement is reached. Regards, iceberg On Apr28, 2:02am, Keith Edmunds <k...@midnighthax.com> wrote: > On Tue, 27 Apr 2010 09:31:50 -0700 (PDT), minkto...@gmail.com said: > > > I'd be interested in a step by step guide to setting up this kind of > > logging. > > I found some older posts that helped in the end. I now have a > modules/logging.py file that looks like: > > def _init_log(): > """ > Fromhttp://article.gmane.org/gmane.comp.python.web2py/11091 > """ > > import logging > from logging.handlers import SysLogHandler > > logger = logging.getLogger(request.application) > logger.setLevel(logging.DEBUG) > handler = SysLogHandler(address='/dev/log') > handler.setLevel(logging.DEBUG) > handler.setFormatter(logging.Formatter( > '%s' % request.application + '[%(process)d]: %(levelname)s: > %(filename)s at line %(lineno)d: %(message)s')) > logger.addHandler(handler) return logger > > logging=cache.ram('once',lambda:_init_log(),time_expire=99999999) > > Then, when I want to log something, I do: > > logging.debug("blah") > > ".debug" can be the other standard values including ".exception", > ".error", ".info", etc > > I don't claim originality for the above: I adapted it slightly from the > URL quoted. > > Given the unexpected challenges in implementing this in web2py, I think it > would make sense to include it in the scaffolding (but I'm probably wrong). > > -- > Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en