I am using ColdBox 3.0.0 RC1-318-GENESIS-14:14 on Linux & Windows
running Adobe CF 9.0.1.
I have Coldbox.cfc setup as the following snippet:
sessionStartHandler = "General.sessionStart",
sessionEndHandler = "General.sessionEnd",
General.sessionStart fires correctly but General.sessionEnd does not
fire. I have "per app configs" enabled in CFIDE and SessionTimeout
set to 2 minutes.
Any suggestions on how to get onSessionEnd to fire?
Are you using the regular or non-inheritance Application.cfc?
What code isn't running on the sessionEnd? You do realize that any output in your onSessionEnd won't be output to the screen, since it happens automatically on the server separate from any request processed via IIS or Apache, right? (just checking)
Also, I assume your application timeout is longer than your session timeout? The onSessionEnd handler only runs if ColdBox still exists.
You could try putting a cfmail or something directly in the Application.cfc's onSessionEnd method to confirm whether ColdFusion is firing it and if the framework and sessionEndHandler setting is being found. If your application.cfc is extending coldbox.cfc, you'll find the method in there. It could be than an error is happening and you just can't see it. Check the coldbox logs, or wrap it in a try catch and E-mail yourself if it errors for debugging purposes.
You could try using the cflog to write a log file yourself to see if it is firing and the email is ending up in a spam folder somewhere.
The only thing I could get to work is the onSessionEnd if I actually manually add cflog to the Application.cfc in the root.
You mean you added it to the onSessionEnd method in coldBox.cfc (which your application.cfc extends) or added an onSessionEnd method in the actual application.cfc file. If you did the latter, then that is overriding the onSessionEnd method in coldbox.cfc and your onSessionEndHandler wouldn’t get called.
I can’t quite tell exactly what you’re doing from what you’ve said. There’s a really good change your session end handler is erroring. I would make sure you have no onSessionEnd in your application.cfc and wrap a try/catch around the onSessionEnd in coldbox.cfc with a log in the cfcatch that tells you the cfcatch.message and see if that gets hit.
I might be off base here, but my understanding (haven't used it) is
that you need to configure a SessionEndHandler in your coldbox config
for the app, then that method should fire at the end of each session.
It's not intended that you override the ColdFusion-level onSessionEnd
handler, either in the core ColdBox.cfc or your app's Application.cfc.
Apologies for the drive-by, should have gone back further in earlier msgs.