A "hidden feature" of PasteDeploy (the package which defines the .ini format for a BFG <package>.ini file) is that you can just inject something in the .ini format found at e.g. http://www.red-dove.com/python_logging.html#config into the BFG app .ini file (literally just paste it in to the BFG app .ini file) and PasteDeploy will configure the logging module. Then you can use the logging API to log to the loggers you've defined in the BFG config file.
Andreas Reuleaux wrote: > I am wondering if there a any examples of using logging in bfg out > there ? > > I have about the simplest bfg web app possible (can certainly give > more details if necessary) and have so far done some debugging by > print, i. e. > > * I call print 'blah' in views.py, models.py once in a while > > * I can see the output in paster.log > > but would like to replace this with something like > > import logging > logging.debug("blah") > > or a little bit fancier (in run.py): > > import logging > logger = logging.getLogger("mylogger") > h = logging.StreamHandler() > h.setLevel(logging.DEBUG) > formatter = ... > h.setFormatter(formatter) > logger.addHandler(h) > > then in views.py > > logger = logging.getLogger("mylogger") > logger.debug("blah") > > > but can't see the output in my paster.log, any advice ? > do I have to set up a wsgi pipeline just for the logging ? > > Alternatively I tried to configure this in the (paster) > website.ini file of my app > > ... > [app:main] > use = egg:website#app > reload_templates = true > > log_stream = sys.stdout > log_level = logging.DEBUG > ... > > (I run my app with ./bin/paster serve ./website.ini) > - no success either: can't see any logging output > > Any advice / docs / examples ? > > > > > -Andreas > _______________________________________________ > Repoze-dev mailing list > Repoze-dev@lists.repoze.org > http://lists.repoze.org/listinfo/repoze-dev > _______________________________________________ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev