[Zope] Re: Log in Plain Text

Maik Jablonski maik.jablonski@uni-bielefeld.de
Wed, 18 Dec 2002 20:41:12 +0100


Juan Manuel Ruiz García wrote:
> Hi,
> 
> I'm interested in tracing actions of my code to a plain txt file in each
> folder of the application. I just want to add one or more lines to the log
> after some actions take place, and I want to know if there's a simple method
> to write one line to that log.txt
> 
> I think I can use "manage_editFile",  but it implies reading all the content
> and adding the new line, but I'm not interested in reading it, just add the
> line!! I think it would be a useless-complex-method reading it before

I don't understand what you exactly want to do, but maybe this one 
should do the job, if you use a DTMLMethod as your log-file and your 
objects to debug are non-folderish. If they are folderish, replace 
self.aq_parent with self:

log_file_obj = getattr(self.aq_parent,'log_file')
log_file_obj.raw = log_file_object.raw + "Your Log Message\n"

-mj