flyctl icon indicating copy to clipboard operation
flyctl copied to clipboard

Add global `--debug` flag to enable debug logs (ala `LOG_LEVEL=debug`)

Open michaeldwan opened this issue 4 years ago • 5 comments
trafficstars

The debug logs are useful for diagnosing issues with the api, builds, remote builders, wireguard, etc. Unfortunately an env variable isn't discoverable so nobody knows about them. We should enable them from a common global flag that people already expect to help with debugging, like --debug, --verbose, --trace, etc.

We might also want to print a message on error instructing the user to try again with that flag.

Hopefully exposing debug logs will help folks figure out issues before heading to the forum or giving up.

michaeldwan avatar Oct 28 '21 18:10 michaeldwan

Hey!

I tried to implement this, it was easier to add the global flag and bind it to viper. I am not sure how to access the flag value at places where LOG_LEVEL=debug env is accessed(i.e inside the /internal package and the /terminal package init) 😅

I think there's a mix of old and new commands and how flags are associated with the context/cmdcontext, not sure the way I approached in the draft PR is the right noe, any pointers to go in the right direction are highly appreciated! thanks

me-diru avatar Mar 30 '22 14:03 me-diru

#2704 helps with this

billyb2 avatar Aug 17 '23 13:08 billyb2

@billyb2 does that PR achieve the same thing as LOG_LEVEL=debug? Or just sets that env variable?

michaeldwan avatar Aug 29 '23 22:08 michaeldwan

It looks like there's already debug level logging via FLYCTL_OUTPUT_HAR here: https://github.com/superfly/flyctl/pull/2289 (undocumented)

andrewbaxter avatar Dec 11 '23 15:12 andrewbaxter

But https://github.com/superfly/flyctl/issues/3107

andrewbaxter avatar Dec 11 '23 16:12 andrewbaxter