开发者

onSessionEnd apparently not firing

I have an INSERT INTO Logfile in onSessionStart, and an UPDATE in onSessionEnd. I've test it manually by calling onSessionEnd from elsewhere within the Application.cfc, so I know that it is working.

But that's the only time it's ever fire开发者_如何学JAVAd.

I wonder if onSessionEnd is never being fired.


I got enough upvotes on my comment, I figured I'd make it an answer for how to debug onSessionEnd methods.

First off, you need to remember that if you call onSessionEnd directly, it's being called during a regular request context. This means it has access to variables that it won't normally have access to if it's being called during the regular session end. This means that testing "manually by calling onSessionEnd" isn't a valid way to test the method.

To that end, the only way to reliably debug an onSessionEnd method is with judicious use of the cflog tag. You need to add cflog entries to flag when the method runs, you need to have error catching, to log errors or dump out cfcatch scopes to a file for review. You also need to make sure that anything you're referencing in the method is passed in via the SessionScope and ApplicationScope arguments, and that you're not referencing any scopes other than Arguments and Server. See livedocs for reference.

Hopefully that helps you find the source of your issue.


I'd add that you even can't call other Application.cfc functions from within onSessionEnd method.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜