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

@test_logs when using @threads #29450

Open
orenbenkiki opened this issue Oct 1, 2018 · 3 comments
Open

@test_logs when using @threads #29450

orenbenkiki opened this issue Oct 1, 2018 · 3 comments
Labels
logging The logging framework

Comments

@orenbenkiki
Copy link

Currently, when using @threads in code tested by @test_logs, the log entries emitted by threads with threadid() > 1 are not captured.

It is possible to work around this by writing:

logger = current_logger()
@threads for ...
    with_logger(logger) do
        ...
   end
end

It seems as though each thread inherits the global logger that was in use at the launch of julia, instead of the logger that was in effect at the time the @threads loop was invoked. Should the default behavior of @threads be modified to the above workaround instead?

@c42f
Copy link
Member

c42f commented Oct 23, 2018

Thanks for the report.

Presumably once #22631 is merged everything related to threading will change. I hope at that stage I'll have time to "take concurrency seriously" as regards to logging :-)

@StefanKarpinski
Copy link
Sponsor Member

All I/O is currently non-thread-safe; #29706 should fix that.

@c42f c42f added the logging The logging framework label Oct 31, 2018
@orenbenkiki
Copy link
Author

#22631 and #29706 were both closed in March...

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

No branches or pull requests

3 participants