You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 streamimportlogginglogging.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.
The text was updated successfully, but these errors were encountered:
Yeah, the remote server only supports logging via stdout/stderr. Some kind of support for Robot's own robot.api.logger API and Python's standard logging module would be nice.
pekkaklarck
changed the title
_intercept_std_streams() does not play nice with python/robotframework logging
Add support for Robot's programmatic logging APIs
Jan 9, 2017
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:
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.
The text was updated successfully, but these errors were encountered: