Description
As far as I can tell, the way how logging works in combination with the PythonRemoteServer depends very much on when the corresponding logging StreamHandler is first created.
If it is created before _intercept_std_streams() is called, then the logging output will be sent to stderr of the server. If it is created after _intercept_std_streams(), then the output is sent as output
to the calling client.
I fixed this for my use case with this change to _intercept_std_streams(), which makes sure that I receive all log messages logged during run_keyword() on the robotframework client:
def _intercept_std_streams(self):
sys.stdout = StringIO()
sys.stderr = StringIO()
# reset the logging handler so that it is connected to the right stderr stream
import logging
logging.getLogger().handlers = []
ch = logging.StreamHandler()
logging.getLogger().addHandler(ch)
NOTE: I mostly opened this issue so that it is documented in case other people run into similiar problems. I'm not sure if this is something that can/should be handled by the default implementation of PythonRemoteServer, since you would have to consider a myriad of possible python logging configurations. Feel free to close.