On Wed, Mar 20, 2019 at 2:12 PM Jonathan Vanasco <[email protected]> wrote: > > > > On Wednesday, March 20, 2019 at 2:22:12 PM UTC-4, Michael Merickel wrote: >> >> The hackiest option possible is to just set a global variable somewhere when >> you use bootstrap. Otherwise you could use a custom setting. > > > Oh, I can think of hackier ways! > > One thing I considered was overriding bootstrap and pshell with a custom > package, which just sets a global variable and then provides the actual > underlying tools. I still have to go through all the ways of running a > pyramid application. I was originally leaning towards custom config files, > but worry about correctly supporting the wide range of config options. > > The use-case for the plugin i'm trying to build is centrally logging how/when > multiple pyramid processes run to monitor health. One project, for example, > has three pyramid apps running and about a dozen cronjobs running bootstrap > or prequest. It's currently using ENV variables to control the logging, but > it's very messy. I'd like to standardize this into something that can > cleanly run for all our projects and be released on PyPi.
If the reason you want to know whether you're running under bootstrap is to determine whether logging has been configured, I ran into that with uwsgi, that it has an option to load a paste.deploy config file and initialize logging from it, but it didn't initialize the logging,. So I added a setting 'logging' with the path to the config file. In my main function, if it's set, I call logging.config.fileConfig on it. I don't remember whether I set the value to '%(__file__)s' or '%(here)/myconfig.ini', because that was another issue I ran into. paste.deploy sets it, and the pyramid.paster functions may set it, but ConfigParser doesn't. -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/CAH9f%3DuoRSbGMpaORyd3%2BESEBHv7ZWdSFoPwRBy%2BSTmk5mqap1A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
