Open Darwinkel opened 1 year ago
Additionally, this seems like the right moment to write some policy about what each logging level means in KAT (and which one should be enabled on production setups).
Some thoughts by @Donnype and me:
Included in debugging mode:
Included in production mode:
In some applications, DEBUG is extremely verbose, and may include all connections and queries in e.g. sqlalchemy. This may make the logs completely unreadable. That's probably not desirable either. We'll have to think about how we propagate/configure logging settings to our libraries.
Level | Description | Examples | Context |
---|---|---|---|
DEBUG | Detailed info, typically only of interest to developers diagnosing a problem. |
|
Development |
INFO | Confirmation the software is operating as expected. |
|
Development Production |
WARNING | Info that needs attention: a problem might be happening or occur in the future. The software is still operational. |
|
Development Production |
ERROR | Due to a serious, unexpected problem, the software has not been able to perform an operation. |
|
Development Production |
CRITICAL | A serious error, indicating that the program itself may be unable to continue running. |
|
Development Production Alerting |
I was actually also thinking about the levels when I saw lots of INFO messages yesterday but also didn't think they should be DEBUG level. I think the isssue is that if we want to log what is currently going on that doesn't indicate a problem we only have INFO. But that makes INFO very verbose. I think what we are missing is a level in between INFO and DEBUG, something we could call VERBOSE.
For example logging every request should not be debug level I think, but logging them with INFO means we log a lot of lines on big installation. If we would log it on a VERBOSE level then people can decide whether they want that or not.
It is possible to add custom levels with python logging: https://docs.python.org/3/library/logging.html#logging.addLevelName
Did some experimenting in https://github.com/minvws/nl-kat-coordination/pull/1314 as part of https://github.com/minvws/nl-kat-coordination/issues/1299. It would be nice if there was a single way to configure logging, maybe through
.env
or by refactoringlogging.json
.Up for discussion
We should answer the following questions:
logging.conf
,logging.json
orlogging.yml
.DEBUG=False
?TODOs
json
, or the other modules should useyml
logging.conf
and is the odd one out