<#8196 [pantsd] Persist logs outside of the workdi...
# github-notifications
c
#8196 [pantsd] Persist logs outside of the workdir Issue created by blorente Problem When users have issues with the pants daemon, the first recommendation is to gather the logs (pantsd.log, exceptions.log...), because that's the best way to diagnose issues. However, the first instinct of many users when something goes wrong with pants is to run
./pants clean-all
and try again, which means that the logs get deleted before we can get them. Solution Pass an optional, daemon-invalidating flag, that is a list of locations where the daemon should log things. This would be passed via env-var to the daemon at startup, here. Then, we should modify the LOGGER in the
logging
crate, so that it accepts multiple streams of output for the pantsd log. We should output the log directory very obviously whenever we throw an error on the client side. Follow-ups Some enhancements that can also be done as part of this or separately: • Make the pantsd logs pid-indexed, similar to the exception logs. So, per each folder, there would be: • A master
pantsd.log
file, which would have all the logs of pantsd up to that point. • One
pantsd.<pid>.log
file per daemon that was started in with that directory. Tradeoffs • This means that we will have potentially spread out logs, and different logfiles might have different contents. For instance, imagine this series of invocations:
Copy code
$ ./pants --enable-pantsd --daemon-log-locations=['/tmp/a'] goals
$ ./pants --enable-pantsd --daemon-log-locations=['/tmp/a', '/tmp/b'] goals
$ ./pants --enable-pantsd --daemon-log-locations=['/tmp/b'] goals
This could be a bit confusing. pantsbuild/pants