logging logout of users

I am looking for solutions to address my need to log to a file whenever a user logs out or session disconnects.

Why do you need your own log? The system already does this for you in wtmpx/utmpx, and you can use last to view the information.