Although logging to a file is very easy, it is also insecure. Users can alter the log files and change them to masquerade their logins and logouts. So I created a more secure way to track user logon and logoff activity to a database.
See my thread here: http://www.petri.co.il/forums/showthread.php?t=64080