Every action that causes you a battle sign:
- after using combat spells/runes
- attacking
- logging in nearby monsters (as well as logging in invisible nearby monsters)
- while being attacked
Also:
- trying to log out in non-logout places
As you mentioned, eating food could prevent you from logging off. It does not, - moving/turning
That's as much as I have checked it right now eating Brown Mushrooms.know