When I posted my first reply, I was thinking of writing to an output log. Do you mean "logout" like in web applications?
You don't need to write any special code for that. At the most, you would want to clean up the resources like connections, sockets,... created by the application. If you have some mechanism which retains some "login" information, you might reset it to some default value.
Why don't you be specific with your question instead of writing in such a vague manner?