Skip to content

Allow logs from non-main threads to be safely logged to the debug file #4092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
daj-code opened this issue Sep 19, 2021 · 2 comments
Open

Comments

@daj-code
Copy link

Robot Framework currently silently drops all logs from non-main threads, as documented in the user guide. This can make it difficult to diagnose test failures when multiple threads are involved, even with the use of the robotbackgroundlogger.

For example, testing an application which makes requests (e.g. HTTP requests) to a server, where a dummy server is run as a separate background thread by the test framework (for tracking, inspecting and validating requests, producing dummy responses etc.), it would be really helpful to have logs from the server able to be logged to the same file(s) as the Robot tests and test infrastructure themselves, in the order they were logged by the respective threads. This would make it much easier to be able to correlate the logs from the different threads and quickly identify where failures are occurring.

The key thing doing this "natively" in robotframework gives (rather than via robotbackgroundlogger) is that this is immediately usable by all users of the framework, and doesn't require specific additional implementation by users. It also means the logs from the various threads are correctly interleaved in the order they were logged, whereas the robotbackgroundlogger logs the stored logs from background threads at a later point in time, requiring more steps to be able to reconstruct events.

This issue initially tracks just implementing this for the debug file (so that there is at least one method for getting these logs), however it would be beneficial to extend this to all log files if possible.

An initial attempt at fixing this issue (for the debug file only) is in #3917.

@pekkaklarck
Copy link
Member

Being able to log from threads, even only to the debug file, would be great. This is pretty complicated stuff (mainly because our logging is a mess internally...) and I don't have time to review the PR in detail right now or in the near future. I assign this tentatively to RF 5.0 scope that it won't be forgotten for long.

@pekkaklarck
Copy link
Member

Sorry for not looking at this issue or PR #3917 lately. There have been many other higher priority issues targeted for RF 5.0 and this was forgotten. I now looked at the PR and noticed few problems that make merging it impossible. We want to get RF 5.0 finally out so I removed this from the milestone. I'll comment the PR shortly and if the issues are resolved, this could be included in RF 5.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants