When starting your recording, select the VUSER_INIT as the initial action to record into. Record your Login process here. Then switch to using the ACTION action for recording the actual process, and lastly switch to using the VUSER_END action when you do the Logout process.
Tip: If your process is more complicated you may want to split it into several actions too. This can be done by creating a new action right from the recording toolbar shown during recording.
This way you will record your 3 separate processes into 3 separate actions.
Note
Using the VUSER_INIT and VUSER_END actions in this way may lead to strange and difficult to handle situations. It is better to have actions for Login and Logoff that get called dynamically when needed in the actual script. The example cases below:
Case 1
If you want a new user to Login/Logoff every iteration you need to do the Login and Logoff processes inside each iteration instead of once in the beginning and end.
Case 2
Imagine a situation where you run your process over and over, and then suddenly something goes wrong and you need to do a Logoff and Logon (or switch user) to fix the process..