Skip to content
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

fix(utils_logfile.log_line): Open file with 'a' mode for safer writing #3822

Merged
merged 1 commit into from
Jan 8, 2024

Conversation

PaulYuuu
Copy link
Contributor

@PaulYuuu PaulYuuu commented Jan 5, 2024

utils_logfile.log_line currently uses 'w' mode to open log files, this causes some log contents missed when closing the log file. For example, when we close the log file, there are some contents in the cache and waiting for writing to the log, so need to reopen it, if use 'w' mode, old contents will be truncated.

ID: 1858
Suggested-by: Lukáš Doktor ldoktor@redhat.com
Signed-off-by: Yihuang Yu yihyu@redhat.com

utils_logfile.log_line currently uses 'w' mode to open log files, this
causes some log contents missed when closing the log file. For example,
when we close the log file, there are some contents in the cache and
waiting for writing to the log, so need to reopen it, if use 'w' mode,
old contents will be truncated.

Suggested-by: Lukáš Doktor <ldoktor@redhat.com>
Signed-off-by: Yihuang Yu <yihyu@redhat.com>
Copy link
Contributor

@pevogam pevogam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I hope you have fully tested this in your own case and assume it has fully addressed your previous concerns

@PaulYuuu
Copy link
Contributor Author

PaulYuuu commented Jan 8, 2024

Cc @luckyh @yanan-fu

Copy link
Contributor

@luckyh luckyh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@luckyh luckyh merged commit fb0bc42 into avocado-framework:master Jan 8, 2024
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants