getporter / porter

Porter enables you to package your application artifact, client tools, configuration and deployment logic together as an installer that you can distribute, and install with a single command.
https://porter.sh
Apache License 2.0
1.23k stars 205 forks source link

Plugins logs are not controlled by the `--verbosity` flag #3189

Closed kichristensen closed 2 months ago

kichristensen commented 3 months ago

Describe the bug

Plugins log level are not controlled by the --verbosity flag, instead it is controlled by the log files log level, e.g., PORTER_LOGS_LEVEL. In all other places the console log level, is controlled by the verbosity, and the code explicitly states that log file level should only affect the log level of the log file.

To Reproduce

Steps to reproduce the behavior:

  1. Ensure that mongo:4.0-xenial is NOT pulled
  2. Run this porter command porter list --verbosity debug
  3. See that the output doesn't contain the debug log, "pulling mongo:4.0-xenial", written by the plugin
  4. Delete the mongo:4.0-xenial image in Docker
  5. Run this porter command PORTER_LOGS_LEVEL=debug porter list --verbosity debug
  6. See that the output now contains the debug log, "pulling mongo:4.0-xenial", written by the plugin

Expected behavior

Plugins log level should be controlled by --verbosity instead of log file log level.

Porter Command and Output

2024-07-13T23:08:19.432+0200    debug   Checking database schema
2024-07-13T23:08:19.432+0200    debug   Selected configured plugin      {"plugin-key": "mongodb-docker"}
2024-07-13T23:08:19.433+0200    debug   Connecting to plugin    {"plugin-command": "/home/kim/.porter/porter plugin run storage.porter.mongodb-docker"}
2024-07-13T23:08:19.433+0200    debug   starting plugin
2024-07-13T23:08:19.435+0200    debug   plugin started
2024-07-13T23:08:19.435+0200    debug   waiting for RPC address
2024-07-13T23:08:19.452+0200    debug   using plugin
2024-07-13T23:08:19.452+0200    debug   plugin address
2024-07-13T23:08:44.966+0200    debug   Initializing installation collection indices
2024-07-13T23:08:44.969+0200    debug   Initializing parameter collection indices
2024-07-13T23:08:44.969+0200    debug   Initializing credentials collection indices
-----------------------------------------------------
  NAMESPACE  NAME  VERSION  STATE  STATUS  MODIFIED
-----------------------------------------------------
2024-07-13T23:08:44.974+0200    debug   received EOF, stopping recv loop
2024-07-13T23:08:44.975+0200    debug   plugin process exited
2024-07-13T23:08:44.975+0200    debug   plugin exited
PORTER_LOGS_STRUCTURED=true PORTER_LOGS_LEVEL=debug porter list --verbosity debug
2024-07-13T23:02:59.799+0200    debug   Checking database schema
2024-07-13T23:02:59.799+0200    debug   Selected configured plugin      {"plugin-key": "mongodb-docker"}
2024-07-13T23:02:59.799+0200    debug   Connecting to plugin    {"plugin-command": "/home/kim/.porter/porter plugin run storage.porter.mongodb-docker"}
2024-07-13T23:02:59.799+0200    debug   starting plugin
2024-07-13T23:02:59.799+0200    debug   plugin started
2024-07-13T23:02:59.800+0200    debug   waiting for RPC address
2024-07-13T23:02:59.818+0200    debug   using plugin
2024-07-13T23:02:59.818+0200    debug   plugin address
2024-07-13T23:02:59.879+0200    debug   pulling mongo:4.0-xenial
2024-07-13T23:03:19.308+0200    debug   running a mongo server in a container on port 27018
2024-07-13T23:03:19.308+0200    debug   waiting for the mongo service to be ready
2024-07-13T23:03:25.172+0200    debug   Initializing installation collection indices
2024-07-13T23:03:25.174+0200    debug   Initializing parameter collection indices
2024-07-13T23:03:25.175+0200    debug   Initializing credentials collection indices
-----------------------------------------------------
  NAMESPACE  NAME  VERSION  STATE  STATUS  MODIFIED
-----------------------------------------------------
2024-07-13T23:03:25.182+0200    debug   received EOF, stopping recv loop
2024-07-13T23:03:25.184+0200    debug   plugin process exited
2024-07-13T23:03:25.184+0200    debug   plugin exited

Version

porter v1.1.0 (b50c1899)