There are three approaches you can use going from the laziest to the most “professional”.
Which you choose is entirely up to you. A lot of times when you are dealing with one developer the most professional is way more work than is warranted.
#Lazyiest
Comment the logging statement out when you no longer need it but want to keep it around for later. When the time comes when you need it again remove the commenting statement to reenable it. Or just delete it and recreate it later if you need it.
#Slightly less lazy
Use the logging levels. For logging statement you may only care about when debugging problems use logDebug. For logging statements that are useful all of the time use logInfo. For problems that are not serious use logWarn and for problems that are serious use logError.
By default logInfo and above will only appear in the logs. If you move openHAB into debug logging mode the logDebugs will also appear in the log file (along with every other debug level log statement).
NOTE: changing the logging level requires an OH reboot unless you are tailing the logs in the karaf console where I think you can adjust the level on the fly.
#More professional
Come up with a log naming scheme that makes sense. For example “lighting”, “presence”, “alarm”, etc. All logging statements that are relevant to lighting should use “lighting” as the first argument to logX.
Apply use of the different logging levels as described above.
Now edit the logging config (see Taming OH 2 Logging and create a logger for each of your named loggers (i.e. “lighting”, “presence”, etc.). Now you can individually modify the logging level for each category of your rules by changing the logging levels. You can even shunt these logs into a separate file if desired.
Personally, I’m lazy. I pretty much just use logInfo and I either comment the logs out or delete them entirely when I’m done. This keeps my openhab.log pretty sparse and it only really reports warnings and errors or when a major sensor detected something (e.g. an external door opened, no one is home) or an actuator took some action (e.g. the light turned on because it is cloudy, the garage door was opened). As an example, in the past two hours there have been 7 entries in my openhab.log and three of those are errors contacting a webservice that stopped working for some reason.
I do use a sane naming scheme for my logging though so if I ever decide to go “professional” with it I’ll be ready. It also helps me segregate stuff out of openhab.log using grep.