[Zope] RE: CST and disappearing variables (still)

Chris McDonough chrism@zope.com
Tue, 2 Oct 2001 10:04:45 -0400

It'd be useful to have a log of session activity for session start and end
(use the sessioning onStart and onEnd mechanisms to do this) as well as a
log method to use before you access a session data object.. you could make a
couple external methods that log session events to the STUPID_LOG.

An onstart script follows:

def sessionOnStart(self, sdo):
    sdm = self.SDM
    isnew = sdm.isTokenNew()
    sd_sid = sdo.id
    sd_pyid = id(sdo)
    s = "%s pyid %s sid %s" % (isnew and 'new token ' or '',
                               sd_pyid, sd_sid)
    from zLOG import LOG, INFO
    LOG('Session onStart', INFO, s)

An onend script follows:

def sessionOnEnd(self, sdo):
    from zLOG import LOG
    LOG('Session info', zLOG.INFO, 'Session sid %s ending' % sdo.id)

Additionally, before you access any sessioning stuff in your code it would
be useful to call a logging method like this:

def logSessionInfo(self, sdm, from=''):
    sdo = sdm.getSessionData()
    isnew = sdm.isTokenNew()
    sd_sid = sdo.id
    sd_pyid = id(sdo)
    sd_len = len(sdo)
    s = "%s pyid %s sid %s len%s" % (isnew and 'new token ' or '',
                                     sd_pyid, sd_sid, sd_len)
    from zLOG import LOG, INFO
    LOG('Session info (%s)' % from, INFO, s)

Use this method like so from dtml *before* every call to your sessioning

 <dtml-call "logSessionInfo(SDM, 'test method')">

When you run into a situation where you suspect a sessioning problem, send
me the relevant time period from the logfile (set via STUPID_LOG_FILE).


- C

----- Original Message -----
From: "Ron Bickers" <rbickers-dated-1002597560.27f40d@logicetc.com>
To: <chrism@zope.com>
Cc: "Zope List" <zope@zope.org>
Sent: Monday, October 01, 2001 11:19 PM
Subject: RE: [Zope] RE: CST and disappearing variables (still)

> > -----Original Message-----
> > From: Chris McDonough [mailto:chrism@digicool.com]
> > No, it seems normal. :-(  Darn.
> >
> > You're not working with multiple frames or windows, are you?
> Nope.
> Any suggestions on how I could set something up to gather debugging
> information?  Like placing something (though I'm not sure what) in various
> places in my code to log whatever may be going on with the request and
> session?
> I'm just grabbing at straws now.  I really have no idea where to go with
> this, but I'm nervous about starting a large upcoming project that would
> CST quite a bit when I'm having random problems.
> _______________________
> Ron Bickers
> Logic Etc, Inc.