<@UR8GF1Z9R>: re: set/get logging destinations: cc...
# development
@bulky-television-48816: re: set/get logging destinations: cc @red-balloon-89377, @average-vr-56795
those methods are intended to propagate logging information between threads
so it's possible that https://github.com/pantsbuild/pants/issues/4999 is spawning the watcher thread before the parent's logging has been set up
i think that the python code will explicitly set the log destination for pantsd... but it's possible that that is too late for the scheduler construction
calls to
, afaict
all traditional writes to stdout/stderr should end up in the log? Or do I need to log through the mechanism somehow?
the logging mechanism is the right* way. it's just the destination that is not necessarily set correctly
in short: i suspect that https://github.com/pantsbuild/pants/blob/9ab9596c698d09e764165af177ed2ddcb1457b5d/src/python/pants/init/logging.py#L133-L151 might not be called in the correct place relative to creating the scheduler
we call it in a bunch of places
but in the pantsd case, we should ensure that it is called before we create the Scheduler... which is here, maybe? https://github.com/pantsbuild/pants/blob/9ab9596c698d09e764165af177ed2ddcb1457b5d/src/python/pants/pantsd/pants_daemon.py#L167-L169
I'm missing some context and I can't find it in the last couple of days of logs. Is there an issue or a pr I can read?
@red-balloon-89377: see the branch in 4999: it uses the methods to
log destinations while spawning a thread
but i think it is doing so before logging has been directed to the appropriate places.
Thanks! I'll take a look tomorrow
(or follow along today, now with extra context :D)
@bulky-television-48816: in the mean time, you might be able to change the
call to an explicit call to
with a TODO
thanks, that did the trick
👍 1
ok. so yea, i think that confirms the above. when that thread is being spawned, we haven't configured logging yet probably.
I’m still not sure of what problem @bulky-television-48816 is trying to solve, but in the branch logging is used the right way (read the destinations with
, set them with
, not manually setting them). My first gut reaction to trying to setup the logging to daemon is that it seems the wrong solution, the right solution being translating all the logging setup to happen before whatever the code that logs is.
Dang I’m really feeling the timezones on this one 🙂
The issue is not when the logging happens: rather, when that thread is spawned.
But yes: need to move logging setup before the Scheduler is created