Re: Can't get pylons to log in mod_python mode..

2009-12-09 Thread Wichert Akkerman
On 2009-12-8 23:20, Graham Dumpleton wrote:
 Paste server does special stuff to initialise the environment for
 logging. Arguably it shouldn't do this and any such initialisation
 should be a side effect of getting the root WSGI application object.

 What it means is that you have to perform the same initialisation
 somehow when using mod_python.

 For discussion of how to do that for mod_wsgi see:

 http://groups.google.com/group/pylons-discuss/browse_thread/thread/9b9add4529b3779c

 You will have to work out how to do the same for mod_python.

The collective.recipe.modwsgi recipe for buildout does that for you.

Wichert.

-- 
Wichert Akkerman wich...@wiggy.net   It is simple to make things.
http://www.wiggy.net/  It is hard to make things simple.

--

You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.




Re: Can't get pylons to log in mod_python mode..

2009-12-09 Thread D D
Thanks for the help.
I hadn't used collective.recipe, however, was able to use info from mod_wsgi
thread for mod_python.

I was also using virtualenv, which is now more elegantly loaded using
helloworld_mod_python.py.

For future reference, this is what it looks like for me:

*.htaccess
*snip
SetHandler python-program
PythonHandler helloworld_mod_python
PythonOption paste.ini /home/username/dev/helloworld/config_merged.ini
PythonPath [ '/home/username/dev/helloworld' ] + sys.path
/snip

*helloworld_mod_python.py*
import os, sys
pcwd = os.path.dirname(__file__)

activate_this = '%s/../env/bin/activate_this.py'%pcwd
execfile(activate_this, dict(__file__=activate_this))

from paste.script.util.logging_config import fileConfig
fileConfig('%s/config_merged.ini' % pcwd)

from paste.deploy import loadapp
application = loadapp('config:%s/config_merged.ini' % pcwd)

from paste.modpython import handler

Before doing the above, I had set it up directly using paste.modpython in
.htaccess.
DD.

On Wed, Dec 9, 2009 at 12:45 AM, Wichert Akkerman wich...@wiggy.net wrote:

 On 2009-12-8 23:20, Graham Dumpleton wrote:
  Paste server does special stuff to initialise the environment for
  logging. Arguably it shouldn't do this and any such initialisation
  should be a side effect of getting the root WSGI application object.
 
  What it means is that you have to perform the same initialisation
  somehow when using mod_python.
 
  For discussion of how to do that for mod_wsgi see:
 
 
 http://groups.google.com/group/pylons-discuss/browse_thread/thread/9b9add4529b3779c
 
  You will have to work out how to do the same for mod_python.

 The collective.recipe.modwsgi recipe for buildout does that for you.

 Wichert.

 --
 Wichert Akkerman wich...@wiggy.net   It is simple to make things.
 http://www.wiggy.net/  It is hard to make things simple.

 --

 You received this message because you are subscribed to the Google Groups
 pylons-discuss group.
 To post to this group, send email to pylons-disc...@googlegroups.com.
 To unsubscribe from this group, send email to
 pylons-discuss+unsubscr...@googlegroups.compylons-discuss%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/pylons-discuss?hl=en.




--

You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.




Can't get pylons to log in mod_python mode..

2009-12-08 Thread D D
Hi,
I have a pylons app, and everything works fine with running via Paster
serve.
However, I have deployed it using mod_python, and I am not able to get it to
print any logs anywhere.

I don't get any logs in chainsaw, console (apache's error_log) or in the
specified log file (/var/log/mysite.log). This only happens when I run it
via mod_python, everything works fine while running through paster serve.
I do get exceptions in apache error_log when there is an exception/crash for
the site.

Below are the relevant parts for logging:

# Logging configuration
[loggers]
keys = root, routes, mysite, sqlalchemy, mako, secure

[handlers]
keys = console, chainsaw, mysitelog

[formatters]
keys = generic, xmllayout

[logger_root]
level = DEBUG
handlers = console, chainsaw, mysitelog

[logger_routes]
level = INFO
handlers =
qualname = routes.middleware

[logger_mysite]
level = DEBUG
handlers =
qualname = mysite

[logger_sqlalchemy]
level = DEBUG
handlers =
qualname = sqlalchemy.engine

[logger_mako]
level = DEBUG
handlers =
qualname = pylons.templating

[logger_secure]
level = DEBUG
handlers =
qualname = pylons.decorators.secure


[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[handler_chainsaw]
class = xmllayout.RawSocketHandler
args = ('localhost', 4445)
level = NOTSET
formatter = xmllayout

[handler_mysitelog]
class = FileHandler
args = ('/var/log/mysite.log','a')
level = DEBUG
formatter = generic

[formatter_generic]
format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S

[formatter_xmllayout]
class = xmllayout.XMLLayout


Any suggestions on where to start debugging this? I am generally pretty new
to mod_python, so any pointers will help.
Thanks,
DD.

--

You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.




Re: Can't get pylons to log in mod_python mode..

2009-12-08 Thread Graham Dumpleton
Paste server does special stuff to initialise the environment for
logging. Arguably it shouldn't do this and any such initialisation
should be a side effect of getting the root WSGI application object.

What it means is that you have to perform the same initialisation
somehow when using mod_python.

For discussion of how to do that for mod_wsgi see:

http://groups.google.com/group/pylons-discuss/browse_thread/thread/9b9add4529b3779c

You will have to work out how to do the same for mod_python.

Graham

On Dec 9, 7:20 am, D D d2n...@gmail.com wrote:
 Hi,
 I have a pylons app, and everything works fine with running via Paster
 serve.
 However, I have deployed it using mod_python, and I am not able to get it to
 print any logs anywhere.

 I don't get any logs in chainsaw, console (apache's error_log) or in the
 specified log file (/var/log/mysite.log). This only happens when I run it
 via mod_python, everything works fine while running through paster serve.
 I do get exceptions in apache error_log when there is an exception/crash for
 the site.

 Below are the relevant parts for logging:

 # Logging configuration
 [loggers]
 keys = root, routes, mysite, sqlalchemy, mako, secure

 [handlers]
 keys = console, chainsaw, mysitelog

 [formatters]
 keys = generic, xmllayout

 [logger_root]
 level = DEBUG
 handlers = console, chainsaw, mysitelog

 [logger_routes]
 level = INFO
 handlers =
 qualname = routes.middleware

 [logger_mysite]
 level = DEBUG
 handlers =
 qualname = mysite

 [logger_sqlalchemy]
 level = DEBUG
 handlers =
 qualname = sqlalchemy.engine

 [logger_mako]
 level = DEBUG
 handlers =
 qualname = pylons.templating

 [logger_secure]
 level = DEBUG
 handlers =
 qualname = pylons.decorators.secure

 [handler_console]
 class = StreamHandler
 args = (sys.stderr,)
 level = NOTSET
 formatter = generic

 [handler_chainsaw]
 class = xmllayout.RawSocketHandler
 args = ('localhost', 4445)
 level = NOTSET
 formatter = xmllayout

 [handler_mysitelog]
 class = FileHandler
 args = ('/var/log/mysite.log','a')
 level = DEBUG
 formatter = generic

 [formatter_generic]
 format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
 datefmt = %H:%M:%S

 [formatter_xmllayout]
 class = xmllayout.XMLLayout

 Any suggestions on where to start debugging this? I am generally pretty new
 to mod_python, so any pointers will help.
 Thanks,
 DD.

--

You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.