Long ago this was considered to be "against the spirit of the game". People would get warnings and eventually a ban if they kept doing it.
Relogging at the entrance of a cave / dungeon was never an issue.
However, I don't know if the current dev team still thinks about it this way.