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

Correct plugin logging #3185

Merged
merged 6 commits into from
Aug 4, 2024

Conversation

kichristensen
Copy link
Contributor

@kichristensen kichristensen commented Jul 12, 2024

What does this change

What issue does it fix

Closes #3189 and closes #3188

Checklist

  • Did you write tests?
  • Did you write documentation?
  • Did you change porter.yaml or a storage document record? Update the corresponding schema file.
  • If this is your first pull request, please add your name to the bottom of our Contributors list. Thank you for making Porter better! 🙇‍♀️

The log level is meant to be used only for log files.

Signed-off-by: Kim Christensen <[email protected]>
The constants used before was numbers, causing the writing to always
fall back to writing as debug

Signed-off-by: Kim Christensen <[email protected]>
Signed-off-by: Kim Christensen <[email protected]>
@kichristensen
Copy link
Contributor Author

@schristoff I think I got a mail about a comment on this PR, but cannot seem to find it again

@schristoff schristoff merged commit ddf7d68 into getporter:main Aug 4, 2024
38 checks passed
@kichristensen kichristensen deleted the fixPluginLogVerbosity branch August 4, 2024 21:15
jmcudd pushed a commit to jmcudd/porter that referenced this pull request Aug 14, 2024
* The plugin logger should use verbosity level

The log level is meant to be used only for log files.

Signed-off-by: Kim Christensen <[email protected]>

* Correctly detect log level from plugin logs

The constants used before was numbers, causing the writing to always
fall back to writing as debug

Signed-off-by: Kim Christensen <[email protected]>

* Correct the documentation

Signed-off-by: Kim Christensen <[email protected]>

* Do not log information messages from the plugin infrastructure

Signed-off-by: Kim Christensen <[email protected]>

---------

Signed-off-by: Kim Christensen <[email protected]>
Co-authored-by: schristoff <[email protected]>
Signed-off-by: John Cudd <[email protected]>
jmcudd pushed a commit to jmcudd/porter that referenced this pull request Aug 19, 2024
* The plugin logger should use verbosity level

The log level is meant to be used only for log files.

Signed-off-by: Kim Christensen <[email protected]>

* Correctly detect log level from plugin logs

The constants used before was numbers, causing the writing to always
fall back to writing as debug

Signed-off-by: Kim Christensen <[email protected]>

* Correct the documentation

Signed-off-by: Kim Christensen <[email protected]>

* Do not log information messages from the plugin infrastructure

Signed-off-by: Kim Christensen <[email protected]>

---------

Signed-off-by: Kim Christensen <[email protected]>
Co-authored-by: schristoff <[email protected]>
Signed-off-by: John Cudd <[email protected]>
@KurtSchenk
Copy link

KurtSchenk commented Sep 30, 2024

Hi @kichristensen,

I don't think I am seeing the fix.

kurt@DESKTOP-ML7A32M:/mnt/c/Users/kurtsc$ cleanup_docker_containers
docker run -it --network host --env PORTER_LOGS_LEVEL=debug -v /var/run/docker.sock:/var/run/docker.sock porter:v1.1.1 porter version
porter v1.1.1 (f8faad1a)

kurt@DESKTOP-ML7A32M:/mnt/c/Users/kurtsc$ cleanup_docker_containers
[…]
kurt@DESKTOP-ML7A32M:/mnt/c/Users/kurtsc$ docker run -it --network host --env PORTER_LOGS_LEVEL=debug -v /var/run/docker.sock:/var/run/docker.sock porter:v1.1.1 porter list --verbosity debug
Checking database schema
Selected default plugin {"plugin-key": "mongodb-docker"}
Connecting to plugin    {"plugin-command": "/root/.porter/porter plugin run storage.porter.mongodb-docker"}
starting plugin
plugin started
waiting for RPC address
plugin address
using plugin
pulling mongo:4.0-xenial
running a mongo server in a container on port 27018
waiting for the mongo service to be ready
Initializing installation collection indices
Initializing parameter collection indices
Initializing credentials collection indices
-----------------------------------------------------
  NAMESPACE  NAME  VERSION  STATE  STATUS  MODIFIED  
-----------------------------------------------------
received EOF, stopping recv loop
plugin process exited
plugin exited

kurt@DESKTOP-ML7A32M:/mnt/c/Users/kurtsc$ cleanup_docker_containers
[…]

kurt@DESKTOP-ML7A32M:/mnt/c/Users/kurtsc/certs$ docker run -it --network host -v /var/run/docker.sock:/var/run/docker.sock porter:v1.1.1 porter list --verbosity debug
Checking database schema
Selected default plugin {"plugin-key": "mongodb-docker"}
Connecting to plugin    {"plugin-command": "/root/.porter/porter plugin run storage.porter.mongodb-docker"}
starting plugin
plugin started
waiting for RPC address
plugin address
using plugin
Initializing installation collection indices
Initializing parameter collection indices
Initializing credentials collection indices
-----------------------------------------------------
  NAMESPACE  NAME  VERSION  STATE  STATUS  MODIFIED  
-----------------------------------------------------
received EOF, stopping recv loop
plugin process exited
plugin exited
	

kurt@DESKTOP-ML7A32M:/mnt/c/Users/kurtsc$ cleanup_docker_containers

[…]

kurt@DESKTOP-ML7A32M:/mnt/c/Users/kurtsc$ docker run -it --network host --env PORTER_LOGS_LEVEL=debug -v /var/run/docker.sock:/var/run/docker.sock porter:v1.1.1 porter list
-----------------------------------------------------
  NAMESPACE  NAME  VERSION  STATE  STATUS  MODIFIED  
-----------------------------------------------------

Still need both in v1.1.1 above like in v1.1.0 below to get the debug detail. "--verbosity debug" alone is not enough.

kurt@DESKTOP-ML7A32M:/mnt/c/Users/kurtsc$ cleanup_docker_containers
[…]

kurt@DESKTOP-ML7A32M:/mnt/c/Users/kurtsc$ docker run -it --network host --env PORTER_LOGS_LEVEL=debug --env PORTER_LOGS_STRUCTURED=true -v /var/run/docker.sock:/var/run/docker.sock porter:v1.1.0 porter list --verbosity debug
2024-09-30T15:47:18.788Z        debug   Checking database schema
2024-09-30T15:47:18.788Z        debug   Selected default plugin {"plugin-key": "mongodb-docker"}
2024-09-30T15:47:18.788Z        debug   Connecting to plugin    {"plugin-command": "/root/.porter/porter plugin run storage.porter.mongodb-docker"}
2024-09-30T15:47:18.789Z        debug   starting plugin
2024-09-30T15:47:18.791Z        debug   plugin started
2024-09-30T15:47:18.791Z        debug   waiting for RPC address
2024-09-30T15:47:18.827Z        debug   using plugin
2024-09-30T15:47:18.828Z        debug   plugin address
2024-09-30T15:47:18.949Z        debug   pulling mongo:4.0-xenial
2024-09-30T15:47:28.563Z        debug   running a mongo server in a container on port 27018
2024-09-30T15:47:28.563Z        debug   waiting for the mongo service to be ready
2024-09-30T15:47:30.620Z        debug   Initializing installation collection indices
2024-09-30T15:47:30.622Z        debug   Initializing parameter collection indices
2024-09-30T15:47:30.623Z        debug   Initializing credentials collection indices
-----------------------------------------------------
  NAMESPACE  NAME  VERSION  STATE  STATUS  MODIFIED  
-----------------------------------------------------
2024-09-30T15:47:30.627Z        debug   received EOF, stopping recv loop
2024-09-30T15:47:30.629Z        debug   plugin process exited
2024-09-30T15:47:30.629Z        debug   plugin exited

@kichristensen
Copy link
Contributor Author

@KurtSchenk Based on the output I have to agree. I will take a look

@kichristensen
Copy link
Contributor Author

@KurtSchenk I have found the error, and is working on a fix, fully covered by tests. Thank you very much for trying it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plugins logs are not controlled by the --verbosity flag Logs from plugins are always shown as debug logs
3 participants