In python3.10 and above, it does not work after configuring it through dictConfig
.
#136
-
Here is an example: ...
LOGGING_DICT = {
"version": 1,
"formatters": {
"colored": {
"format": "%(log_color)s%(levelname)-8s%(reset)s %(blue)s%(message)s",
"datefmt": "%Y-%m-%d %H:%M:%S",
"()": "colorlog.ColoredFormatter",
},
},
"handlers": {
"colored": {
"level": "INFO",
"class": "colorlog.StreamHandler",
"formatter": "colored",
},
},
"loggers": {
"example": {
"lever": "INFO",
"handlers": ["colored"],
"propagate": True,
},
},
}
logging.config.dictConfig(LOGGING_DICT)
logger = logging.getLogger("example")
logger.info("This is an info message") There is no printed result. What is the reason for this? Is there an effective solution? Python Version: 3.10.12 |
Beta Was this translation helpful? Give feedback.
Answered by
borntyping
Mar 5, 2025
Replies: 1 comment 1 reply
-
I regret to inform you this is a simple typo: "loggers": {
"example": {
- "lever": "INFO",
+ "level": "INFO",
"handlers": ["colored"],
"propagate": True,
},
}, |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
borntyping
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I regret to inform you this is a simple typo: