List Info

Thread: Re: mod_wsgi and pylons, Logging




Re: mod_wsgi and pylons, Logging
user name
2007-12-19 17:30:57
Hey Graham,

Actually, I thought I was having the same issue since I was
getting no
logging at all from Pylons when using mod_wsgi. However,
after trying
this and it not working, it looks like it has to do with
using
mod_wsgi in daemon mode. (No, not on FreeBSD this time). I
can seem to
log from the wsgi script, but once in Pylons it just doesn't
spit
anything out unless running in embedded mode.

I'm simply using:

	WSGIApplicationGroup %
	WSGIDaemonProcess localdev-site user=me group=me
	WSGIProcessGroup localdev-site
	WSGIScriptAlias / /path/to/script.wsgi

And I get nothing.

	WSGIApplicationGroup %
	#WSGIDaemonProcess localdev-site user=me group=me
	#WSGIProcessGroup localdev-site
	WSGIScriptAlias / /path/to/script.wsgi

Will get me exception traces (the main reason I'm doing
this) and
general logging, without any special setup, just using the
default
pylons logging config and without the hack mentioned in this
thread.

On a dual proc, dual core amd64 setup btw

-jeff

On Nov 17, 8:44 pm, Graham Dumpleton
<Graham.Dumple...gmail.com>
wrote:
> On Nov 17, 3:33 pm, PyDevler <hnass...gmail.com> wrote:
>
> > When I previously mentioned invistigating. I
managed to get it to log
> > by manually adding a handler from within my
controller-xyz.py. However
> > it is refusing to load my config. It is for some
reason refusing to
> > use the Formatter line, that I adjust from within
controller-xyz.py.
> > However, it changes the log-level which I also set
in the same command
> > I pass the formatter string. I am unable to
explain what pylons is
> > doing under mod-wsgi.
>
> Sorry for taking so long to get back to this, got
diverted on more
> important things.
>
> In the documentation for Pylons logging it says:
>
> """paster, when loading an application
via the paster serve, shell or
> setup-app commands, calls the logging.fileConfig
function on that
> specified ini file if it contains a 'loggers' entry.
> logging.fileConfig reads the logging configuration from
a ConfigParser
> file."""
>
> This would suggest using 'paster' it does special stuff
which wouldn't
> be getting done if using mod_python, mod_wsgi or any
other hosting
> solution besides 'paster'.
>
> The documentation is a bit deceiving here as took that
to mean
> 'fileConfig' with 'logging' module, but on Python 2.3
at least, no
> such function exists. Turns out what you need in WSGI
script file is:
>
> import os, sys
> __here__ = os.path.dirname(__file__)
> __parent__ = os.path.dirname(__here__)
>
> sys.path.append(__parent__)
>
> from paste.script.util.logging_config import
fileConfig
> fileConfig('%s/development.ini' % __parent__)
>
> from paste.deploy import loadapp
>
> application = loadapp('config:%s/development.ini' %
__parent__)
>
> Ie., fileConfig comes from
'paste.script_util.logging_config'.
>
> If that function is called with Pylons ini file then
logging if then
> output.
>
> Graham

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "pylons-discuss" group.
To post to this group, send email to pylons-discussgooglegroups.com
To unsubscribe from this group, send email to
pylons-discuss-unsubscribegooglegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: mod_wsgi and pylons, Logging
user name
2007-12-19 20:28:18
Which Apache error log file are you looking in? Do you have
VirtualHost specific CusomLog defined?

When run in mod_wsgi daemon mode, the sys.stderr output will
be
redirected to a VirtualHost specific error log file if
WSGIDaemonProcess was defined in the context of the
VirtualHost.

When in mod_wsgi embedded mode, the sys.stderr output will
always go
to the main Apache error log file even if a VirtualHost
specific error
log file has been defined.

Graham

On Dec 20, 10:30 am, "progr...gmail.com"
<progr...gmail.com> wrote:
> Hey Graham,
>
> Actually, I thought I was having the same issue since I
was getting no
> logging at all from Pylons when using mod_wsgi.
However, after trying
> this and it not working, it looks like it has to do
with using
> mod_wsgi in daemon mode. (No, not on FreeBSD this
time). I can seem to
> log from the wsgi script, but once in Pylons it just
doesn't spit
> anything out unless running in embedded mode.
>
> I'm simply using:
>
>         WSGIApplicationGroup %
>         WSGIDaemonProcess localdev-site user=me
group=me
>         WSGIProcessGroup localdev-site
>         WSGIScriptAlias / /path/to/script.wsgi
>
> And I get nothing.
>
>         WSGIApplicationGroup %
>         #WSGIDaemonProcess localdev-site user=me
group=me
>         #WSGIProcessGroup localdev-site
>         WSGIScriptAlias / /path/to/script.wsgi
>
> Will get me exception traces (the main reason I'm doing
this) and
> general logging, without any special setup, just using
the default
> pylons logging config and without the hack mentioned in
this thread.
>
> On a dual proc, dual core amd64 setup btw
>
> -jeff
>
> On Nov 17, 8:44 pm, Graham Dumpleton
<Graham.Dumple...gmail.com>
> wrote:
>
> > On Nov 17, 3:33 pm, PyDevler <hnass...gmail.com> wrote:
>
> > > When I previously mentioned invistigating. I
managed to get it to log
> > > by manually adding a handler from within my
controller-xyz.py. However
> > > it is refusing to load my config. It is for
some reason refusing to
> > > use the Formatter line, that I adjust from
within controller-xyz.py.
> > > However, it changes the log-level which I
also set in the same command
> > > I pass the formatter string. I am unable to
explain what pylons is
> > > doing under mod-wsgi.
>
> > Sorry for taking so long to get back to this, got
diverted on more
> > important things.
>
> > In the documentation for Pylons logging it says:
>
> > """paster, when loading an
application via the paster serve, shell or
> > setup-app commands, calls the logging.fileConfig
function on that
> > specified ini file if it contains a 'loggers'
entry.
> > logging.fileConfig reads the logging configuration
from a ConfigParser
> > file."""
>
> > This would suggest using 'paster' it does special
stuff which wouldn't
> > be getting done if using mod_python, mod_wsgi or
any other hosting
> > solution besides 'paster'.
>
> > The documentation is a bit deceiving here as took
that to mean
> > 'fileConfig' with 'logging' module, but on Python
2.3 at least, no
> > such function exists. Turns out what you need in
WSGI script file is:
>
> > import os, sys
> > __here__ = os.path.dirname(__file__)
> > __parent__ = os.path.dirname(__here__)
>
> > sys.path.append(__parent__)
>
> > from paste.script.util.logging_config import
fileConfig
> > fileConfig('%s/development.ini' % __parent__)
>
> > from paste.deploy import loadapp
>
> > application = loadapp('config:%s/development.ini'
% __parent__)
>
> > Ie., fileConfig comes from
'paste.script_util.logging_config'.
>
> > If that function is called with Pylons ini file
then logging if then
> > output.
>
> > Graham
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "pylons-discuss" group.
To post to this group, send email to pylons-discussgooglegroups.com
To unsubscribe from this group, send email to
pylons-discuss-unsubscribegooglegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )