It doesn't matter at the moment, you can log out in the middle of combat if you want to.
Eventually, you're "supposed" to log off while docked at stations. Dunno if anything has been really settled about what happens if you don't. There's been talk of your ship just lingering, being put on AI control for a while, all sorts of stuff.
Don't worry about taking up spots when you log off, your ship will disappear and free up the pad. When you log on in the hangar you might cause someone to have their landing pad reassigned, but I wouldn't worry about that, either. I think traffic control has gotten better about that. (Except at Chango Dock... those guys must have a hell of a union to still have jobs.)
The one thing I'd avoid is logging off while in supercruise when very near the orbit of a celestial body. I've never heard of it happening, but apparently when you log off, your absolute position is saved rather than your position relative to whatever you were near when you logged out. So it's theoretically possible you could log in again inside a moon, or something.