Pyramid paste/logging/uwsgi problem...

760 views
Skip to first unread message

Vlad K.

unread,
Jul 13, 2012, 2:44:16 PM7/13/12
to pylons-...@googlegroups.com

I think this is getting old....

Please, how do I run a Pyramid 1.3 app, full with logging as specified
in the .ini file, under uWSGI.



Thanks.

--

.oO V Oo.

Roberto De Ioris

unread,
Jul 13, 2012, 3:41:13 PM7/13/12
to pylons-...@googlegroups.com

>
> I think this is getting old....
>
> Please, how do I run a Pyramid 1.3 app, full with logging as specified
> in the .ini file, under uWSGI.
>

uwsgi --http :8080 --ini-paste-logged deployement.ini

(substitute deployment.ini with your config file).

You have to use at least uWSGI 1.2


--
Roberto De Ioris
http://unbit.it

Vlad K.

unread,
Jul 13, 2012, 3:54:48 PM7/13/12
to pylons-...@googlegroups.com
On 07/13/2012 09:41 PM, Roberto De Ioris wrote:
>> I think this is getting old....
>>
>> Please, how do I run a Pyramid 1.3 app, full with logging as specified
>> in the .ini file, under uWSGI.
>>
> uwsgi --http :8080 --ini-paste-logged deployement.ini
>
> (substitute deployment.ini with your config file).
>
> You have to use at least uWSGI 1.2
>
>

I must admit I didn't try directly from command line, but I use uwsgi
config INI because of vassals and several sites run under same uwsgi
server, so I like to drop them in /etc/uwsgi.d/ which I configured in my
custom sysvinit script.

So this is my config INI (not the paste INI):

[uwsgi]
master = true
processes = 1
enable-threads = true
single-interpreter = true
threads = 2
uid = siteuser
gid = siteuser
paste = config:/home/siteuser/Sitename/production.ini
chdir = /home/siteuser
virtualenv = /home/siteuser/Sitename/virtualenv
socket = /tmp/uwsgi/uwsgi-sitename.socket


So instead of "paste" I tried "ini-paste-logged" (assuming command line
parameters are equal to the INI params), and it doesn't work. I mean the
site works but the logging config is not picked up.


Meanwhile I found a way on another thread on the list. Basically, add
custom entry in production.ini, say "logging.config" (or whatever), and
then in the __init__'s main:

logging.config.fileConfig(settings["logging.config"]) # or whatever the
entry in .ini is


This works for now, but I don't think it's very elegant. I was looking
for a way to get the INI path in main() without having to resort to
settings tricks, but either I missed it in the docs, or there is no way.
Methinks whatever pserve is doing should be exposed (if it isn't already
and I missed it) to main().

Roberto De Ioris

unread,
Jul 14, 2012, 1:43:32 AM7/14/12
to pylons-...@googlegroups.com

> On 07/13/2012 09:41 PM, Roberto De Ioris wrote:
>>> I think this is getting old....
>>>
>>> Please, how do I run a Pyramid 1.3 app, full with logging as specified
>>> in the .ini file, under uWSGI.
>>>
>> uwsgi --http :8080 --ini-paste-logged deployement.ini
>>
>> (substitute deployment.ini with your config file).
>>
>> You have to use at least uWSGI 1.2
>>
>>
>
> I must admit I didn't try directly from command line, but I use uwsgi
> config INI because of vassals and several sites run under same uwsgi
> server, so I like to drop them in /etc/uwsgi.d/ which I configured in my
> custom sysvinit script.
>
> So this is my config INI (not the paste INI):
>
> [uwsgi]
> master = true
> processes = 1
> enable-threads = true
> single-interpreter = true
> threads = 2
> uid = siteuser
> gid = siteuser
> paste = config:/home/siteuser/Sitename/production.ini
> chdir = /home/siteuser
> virtualenv = /home/siteuser/Sitename/virtualenv
> socket = /tmp/uwsgi/uwsgi-sitename.socket


ini-paste-logged does not work in 'vassal' mode.

Use --paste-logger

paste = config:/home/siteuser/Sitename/production.ini
paste-logger = /home/siteuser/Sitename/production.ini

or better:

mypaste = /home/siteuser/Sitename/production.ini
paste = config:%(mypaste)
paste-logger = %(mypaste)
Reply all
Reply to author
Forward
0 new messages