Don't create the log handlers everytime you get an request. create it
in Root.__init__ and just call self.log.debug.

On 9/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> hi ,
>
>      I am maintaining user log messages in turbogears .
> This is my controller :
>
> class Root(controllers.RootController):
>     @expose(template="Dam.templates.welcome")
>     def index(self):
>         fileName = '/home/antony/Desktop/DAM/Dam/dam.log'
>         iHandler = logging.FileHandler(fileName,'a+')
>         iHandler.setFormatter(logging.Formatter("%(levelname)-8s|%(asctime)s|%
> (pathname)s,%(name)s,line %(lineno)s|%(message)s"))
>         logName='DEBUG'
>         iLog = logging.getLogger(logName)
>         iLog.addHandler(iHandler)
>         iLog.setLevel(logging.DEBUG)
>         iLog.debug("msg")
>         return dict()
> I am calling the index method.the welcome page gets loaded.
>
> when i load welcome page. first time a single log entry is made,
> second time two log entries are getting appended, third time three log
> entries are getting appended etc.
> i want only single log entry per function call.
>
>
> >
>


-- 
cheers
    elvelind grandin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" 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/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to