On Nov 17, 3:33 pm, PyDevler <[EMAIL PROTECTED]> 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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---