Re: [Zope] Product logging to Postgres

2005-07-15 Thread Chris Withers

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
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Product logging to Postgres

2005-07-14 Thread David Pratt

On Thursday, July 14, 2005, at 05:40 PM, Dieter Maurer wrote:


David Pratt wrote at 2005-7-12 10:44 -0300:

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


You can import them as soon as you execute the necessary security
declarations (--> "PythonScripts" --> "README").


Hi Dieter.  I realize that external methods are needed in most cases to 
import into a Script Python.
I was hoping perhaps logging might be one of the classes that could be 
imported without going to external methods.





to to this


In order to let Zope's "logging classes" log to postgres, you
will need to implement a new log handler that does this...


Thanks.  I guess my big decision with this was whether I ought to use 
what already exists in Zope or use python's logging class.  Either way 
I have to write something to handle, store, retrieve the logs for sure.



Regards,
David
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Product logging to Postgres

2005-07-14 Thread Dieter Maurer
David Pratt wrote at 2005-7-12 10:44 -0300:
>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

You can import them as soon as you execute the necessary security
declarations (--> "PythonScripts" --> "README").

>to to this

In order to let Zope's "logging classes" log to postgres, you
will need to implement a new log handler that does this...

-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )