Enable logging with logging support also when generating results.

To fix #1821, commit cd5352d44543db91c6229c7c38853066f1608be3
automatically removed RobotHandler from logging after tests were
run. This broke a test that verified that listeners can log messages
using logging also after execution and messages end up to
syslog. That's not too important feature, but fixing the problem
wasn't that hard either.

Now RobotHandler is enabled also during result generation when using
robot.run. It's also enabled when calling TestSuite.run, but only if
not already registered.

One test still breaks on Python 2.6. That seems to be caused by
logging bug that's fixed in 2.7. Need to still investigate.
Workaround for logging bug in Python < 2.7.

At program exit logging module calls flush for streams it has
intercepted without looking are they already closed. In Python 2.7
resulting ValueError is silenced, but the error and traceback gets
logged to the console with earlier versions.

We avoid the error by replacing flush method of StringIOs we've used
with a no-op lambda. Earlier the error was silenced because we set
logging.raiseExceptions to False, but nowadays such logging config is
disabled after tests are run. This finally fixes #1821.

Also added an unrelated comment to not-so-obvious code.