Open leugenel opened 6 years ago
Hmmm... that's correct. Slash handlers are thread bound and not application bound. I guess we should change that. Thanks for reporting!
Thanks! Can I do something to fix it temporarily inside my code?
On second glance it looks like applicationbound
is indeed used. I'll take a closer look at your example to see what's going on there...
Just to be clear - I think that in your example the thread outlives the test. Where do you expect the log to appear?
I would expect to see it even at the console using -vvv flag
I think in your case it can actually outlive the session, meaning the global handler (including console) gets popped out of the stack...
So what you recommend in this case? It looks like a simple use case...
The question is what you expect this example to do... Do you expect the thread to outlive the session?
If this is unintentional I would add a workaround that would wait on that thread on session cleanup (through add_cleanup(..., scope="session")
)
Otherwise, you could initialize your own logbook handler (thread-bound) inside the thread, and take the current log path from context.session.log
somehow...
I see - thanks!
The log doesn't fire from the
execute
method and works properly fromtest_general