Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add way to change log level without restart #42

Open
awlayton opened this issue Jan 31, 2020 · 8 comments
Open

Add way to change log level without restart #42

awlayton opened this issue Jan 31, 2020 · 8 comments
Assignees

Comments

@awlayton
Copy link
Member

Have trace on always is too much information.

@awlayton
Copy link
Member Author

So there is a way to change the log level of pino, we would just need a way to signal the code to do so. My first thought was maybe having code watch some file?

@aultac
Copy link
Member

aultac commented Mar 12, 2021 via email

@awlayton
Copy link
Member Author

Re upping the container is restarting so that does not really apply here.

@awlayton
Copy link
Member Author

With a file we could in effect update the DEBUG variable, not just pick between info, trace etc.

@aultac
Copy link
Member

aultac commented Mar 13, 2021 via email

@abalmos
Copy link
Member

abalmos commented Mar 13, 2021

This wouldn’t be necessary if docker would just let you alter the environment of a running container from outside.

Even if you could change the env var, you would still have to restart the process for it to see the new value. You can't change the environment of a running process from outside of the process. At that point, why not just recreate the container? It should be fast now that it's based on an image.

Seems like a config file is the only real way forward. It would be pretty "standard" to change a config and then send the process a SIGHUP to re-read it. The crazy config setup could implement this for all services. I suppose the config lib would need to offer some sort of call back interface for things like pino to register with.

You could also set debug's $DEBUG value at runtime (say as an overridable default) from the config as well. Would just need to be sure to load the config before debug.

@awlayton
Copy link
Member Author

Yes simply changing the environment variables at runtime will not do anything.

We need actual code that is triggered either on file change or a signal or something. Then that code can make the appropriate calls to pino and/or debug to update the log settings.

@aultac
Copy link
Member

aultac commented Mar 20, 2021 via email

@awlayton awlayton self-assigned this Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants