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

Logger may interleave lines in multi-threaded context #84

Closed
ahueck opened this issue Jul 19, 2021 · 0 comments · Fixed by #108
Closed

Logger may interleave lines in multi-threaded context #84

ahueck opened this issue Jul 19, 2021 · 0 comments · Fixed by #108
Assignees
Labels
bug Something isn't working

Comments

@ahueck
Copy link
Contributor

ahueck commented Jul 19, 2021

Happens with MPI_LOGGER=OFF.

Fix

  • Change:
    llvm::errs() << (LEVEL) << " " << LOG_BASENAME_FILE << ":" << __func__ << ":" << __LINE__ << ": " << MSG << "\n";
  • To:
    std::string s;
    llvm::raw_string_ostream rso(s);
    rso << (LEVEL) << LOG_BASENAME_FILE << ":" << __func__ << ":" << __LINE__ << ":" << MSG << "\n";
    // log rso.str()...
@ahueck ahueck added the bug Something isn't working label Jul 19, 2021
@ahueck ahueck self-assigned this Jul 19, 2021
ahueck added a commit that referenced this issue Jul 19, 2021
ahueck added a commit that referenced this issue Jul 19, 2021
ahueck added a commit that referenced this issue Jul 19, 2021
A full log string is passed to errs() instead of multiple << operator calls. This should reduce log message interleaving on console for multi-threaded apps.
@ahueck ahueck mentioned this issue Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant