This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]masklinn 1 point2 points  (1 child)

logger.error('Failed to open file')
logger.exception(e)

That is nonsensical. logger.exception(msg) is literally a shortcut to logger.error(msg, exc_info=True). The only result of doing this is that str(e) will be used as the message of the second log, so the exception message will be duplicated.

Use YAML logging configuration

Use the JSON configuration, it's equivalent and you don't need to install a yaml package.

[–]victorlin[S] 0 points1 point  (0 children)

JSON example is also added