cnaas-nms icon indicating copy to clipboard operation
cnaas-nms copied to clipboard

Logging requires redis

Open stveit opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe. Logging is done via the log.py file, where get_logger is used to get a logger object. This obejct has a handler for writing to redis. If redis is not running, logging will not work in cnaas-nms, as it will crash when trying to connect to redis. So if you try to run tests that test code trying to log, you are required to have a redis session.

An overall problem is that library code trying to log sets up logging handlers. Handlers should be setup by the program using the library, for instance the main program.

Describe the solution you'd like Remove setup of handlers in get_logging(), and instead require that handlers and stuff is setup by the main program that is using the code. This way, tests can just decide to not setup the redis logging, and are then able to run tests without needing a redis session.

stveit avatar Dec 01 '21 09:12 stveit