________________________________
From: [email protected] [[email protected]] on behalf of 
C Anthony Risinger [[email protected]]
Sent: Wednesday, January 25, 2012 10:46 AM
To: uWSGI developers and users list
Cc: Roberto De Ioris
Subject: Re: [uWSGI] emperor mode - logging


On Jan 25, 2012 9:31 AM, "Damjan" <[email protected]<mailto:[email protected]>> 
wrote:
>
> >> /usr/local/bin/uwsgi --emperor /etc/uwsgi/vassals -d
> >> /var/log/uwsgi_emp.log
> >>
> >> For the configs I place into vassals, how do I make *each* of them log
> >> into a different logfile ?   Reasons:  for some of them: the volume is
> >> large -- but more specifically -- I need to look at the behavior of the
> >> apps individually.
> >>
> >> An example of one such config I'm testing with:
> >>
> >> <uwsgi>
> >>     <pythonpath>/webapps/bookimages/uwsgi</pythonpath>
> >>     <app mountpoint="/books">
> >>         <script>bookimages_wsgi</script>
> >>     </app>
> >>     <master/>
> >>     <processes>2</processes>
> >>     <socket>127.0.0.1:40002<http://127.0.0.1:40002></socket>
> >>     <chdir>/webapps/bookimages</chdir>
> >> </uwsgi>
> >>
> >
> >
> > You can add <logto> option in each of the vassal config to point to a
> > different file.
>
> I was just thinking about the same thing, and I was hoping to just set
> the
> UWSGI_VASSAL_LOGTO = %d/run/uwsgi.log
> environment variable in the emperor. Unfortunately  this didn't work,
> the %d was not expanded in the vassals.

I just saw/realized this while looking thru code the other day ...

Does $(env_var) work?

Also looks like @(file) will do something cool, include probably.

You could possibly use an env var to fill a placeholder in a common config file 
... not sure offhand how to include from XML though.

--

C Anthony [mobile]


=====================================================================


The following is what I did that worked for what I needed - I added the pidfile 
and daemonize lines.

Logging now goes into a different file for every named file I place in the 
vassals directory.


<uwsgi>
    <pythonpath>/webapps/bookimages/uwsgi</pythonpath>
    <app mountpoint="/books">
        <script>bookimages_wsgi</script>
    </app>
    <master/>
    <show-config/>
    <processes>2</processes>
    <socket>127.0.0.1:40002</socket>
    <chdir>/webapps/bookimages</chdir>
    <pidfile>/var/run/uwsgi/%n.pid</pidfile>
    <daemonize>/var/log/uwsgi/%n.log</daemonize>
</uwsgi>


Now for more fun.  I tried using inherit mode to setup some defaults for my 
apps.

So instead of starting like this:


/usr/local/bin/uwsgi --emperor /etc/uwsgi/vassals -d /var/log/uwsgi_emp.log


I tried this (with my daemonize line above in the defaults.ini as daemonize = 
/var/log/uwsgi/%n.log) -- but it threw an error on starting.


# /usr/local/bin/uwsgi --inherit /etc/uwsgi/defaults.ini


So I landed here instead:
/usr/local/bin/uwsgi --inherit /etc/uwsgi/defaults.ini 
--daemonize=/var/log/uwsgi/uwsgi.log --pidfile=/var/run/uwsgi/uwsgi.pid


Sample defaults file is below.  The problem, which I verified in the log 
captured in the app log *above*, is none of these settings

made it into the master for the app.   harakiri didnt get turned on, idle not 
set, etc.   Am I missing something ?


[uwsgi]
no-default-app = true
# master = true
memory-report = true
harakiri = 120
harakiri-verbose = true
idle = 300

emperor = /etc/mypub/uwsgi/vassals


Thoughts?  And Thanks!

Roger


_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to