Query about severity of logging level in the Logging module

Hi, I have been using the Logging module in my projects and absolutely love it.

However, as I get deeper, I wonder why the logging levels are not aligned with the severity levels defined in section 6 of RFC5424.

Apologies if the answer is obvious or has been addressed elsewhere, but I’m not a professional software developer, and it seems that using an established standard would have been the efficient logic.

Update 1 [16-Jul-2024]: Added link to the RFC.

The logging module predates the linked documented by 6 years (it was added in python2.3 in 2003) and is AFAIK based on the design of an earlier java library that is a few years older still.

Changing the definitions is just unnecessary churn with very little if any actual benefit. If for your applications you want to use a different system, you are free to do that - Python makes very few assumptions about the meaning of the logging levels, you just might need to overwrite quite a few defaults.

1 Like

OK, understood. Wasn’t suggesting that this should change. Was only curious about the logic behind the choices. Thanks for clarifying.

I agree about the minimal assumptions, it’s very helpful. Especially the availability of both numeric and string-based level definitions. Much appreciated.

I have also been going through the docs, and there isn’t a straightforward guide to custom logging levels. I’ve tried…

Am I looking in the wrong place?

There is the function that defines a new level alias: addLevelName and a small warning against custom levels for library authors.

After defining them you should be able to use the just like the default named levels - What further questions do you have?

1 Like

Whoa! I clearly scrolled past that one. Another reason to love the Logging module.

Apologies for my sloppiness. Another reason to go to bed and get some rest.

Thanks for your patience with me.