Logout by a button

I want to logout by a button but with the code system.security.logout() it doesn’t clear for me.