Capturing and logging stdout/stderr on workers
See original GitHub issueFor various reasons, it is nice to be able to use stdout
and stderr
on workers and see the results. This can be useful in simplistic debugging attempts, using 3rd party code that already print
s to one (or both) of these, etc. However it appears stdout
and stderr
are ignored in these settings currently.
A very useful feature would be to capture stdout
and stderr
on the worker and redirect them to a logger. One simple option would be to use the loggers distributed.worker.stdout
and distributed.worker.stderr
with info
level messages. These loggers seem to be unused now and redirecting to them seems to work fine. This would at least give users one reasonable way to get this information.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:11
- Comments:15 (12 by maintainers)
Top Results From Across the Web
How to get php-worker to log to stdout / stderr - Stack Overflow
It will show logs successfully, but I don't know why it works. So I write down the answer here for those who have...
Read more >Capturing both stdout and stderr together in a log file
Write a small program that writes to both stdout and stderr: vim mini_program # file contents: echo "1 -- This is normal output"...
Read more >Use "Redirect stdout/stderr logging enabled" checkbox in ...
Is it a good idea to check "Redirect stdout/stderr logging enabled" checkbox in Production OIM server?
Read more >How to get php-fpm to log to stdout / stderr when running in a ...
Do some php-fpm config # Redirect worker stdout and stderr into main error log # Activate the fpm access log # Enable display...
Read more >Kubernetes Logging: 101 Guide to Logs, Best Practices & More
Container logs are logs generated by your containerized applications. The easiest way to capture container logs is to use stdout and stderr ....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In https://github.com/dask/distributed/pull/5217 (the ticket is a bit cryptic, below example pseudo code) we built a functionality to support “remote printing” that may be useful for some people in here. It appears we never updated the docs appropriately, at least I couldn’t find it.
If you run a function on a remote worker and are using the distributed print function, it will print this message on stdout of your worker and forwards the message to the client and prints it on the client as well. The same works for
warn
as the stdlib warn works and you can build your own client handlers usingClient.subscribe_topic
in combination withWorker.log_event
.This obviously only scales to a certain level as was already pointed out with collecting logging information in a central place. At the very least the “simplistic debugging attempt” use case should be covered by this. For proper logging, I would not recommend using this.
@ntonasa See my gist here for a proof-of-concept of how to use the subscribe mechanism that was added in #5217 to configure the forwarding of arbitrary logging statements by tasks running on workers to the client session.