[Zope] Product logging to Postgres

Chris Withers chris at simplistix.co.uk
Fri Jul 15 12:48:15 EDT 2005


David Pratt wrote:
> I am wanting to log a product to postgres database. I want to write to 
> the log from my Script Python methods (in skins) when certain actions 
> occur. The product itself uses a number of zsql methods.  Can I import 
> existing zope logging classes in my Script Python to to this or will I 
> need to rely on external methods.   Any recommendations or pointers to 
> anything similar would be appreciated.

For something as specialised as this, I'd just insert appropriate calls 
to appropriate ZSQL methods where you need them.

The logging framework is great when you want to be able to switch where 
log entries are written in a more dynamic fashion, or enable other users 
of your code to decide to log to a different place.

You, however, want to log into postgres only, as best I can see, so 
there's no point in fighting the security restrictions in your 
particular case ;-)

That said, it'd be great if you could at least do:

from logging import getLogger
logger = getLogger('event.something')
logger.log('something')

...without loads of unauthorized errors popping up :-S

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the Zope mailing list