Skip to content

bpo-40544: Set the validate field in logging Formatter with fileConfig#19991

Closed
mirii1994 wants to merge 2 commits intopython:mainfrom
mirii1994:formatter-fix
Closed

bpo-40544: Set the validate field in logging Formatter with fileConfig#19991
mirii1994 wants to merge 2 commits intopython:mainfrom
mirii1994:formatter-fix

Conversation

@mirii1994
Copy link

@mirii1994 mirii1994 commented May 8, 2020

https://bugs.python.org/issue40544
This PR fixes python 3.8 bug that caused because of the add of the validate param (default: True) in logging.Formatter, it causing it to throws ValueError exception if the format param is not one of the 3 styles.
There was no way to set validate field when using logging.config.fileConfig, which breaks the code to users who want to upgrade to 3.8.

https://bugs.python.org/issue40544

@mirii1994 mirii1994 requested a review from vsajip as a code owner May 8, 2020 08:07
@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@mirii1994

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@vsajip
Copy link
Member

vsajip commented May 10, 2020

Are you using a custom style which is not one of the three supported styles? If so, perhaps dictConfig should be used instead. I would prefer to encourage people to move over to dictConfig as it supports configuring more of the logging API. The fileConfig usage should be for legacy applications only.

@mirii1994
Copy link
Author

@vsajip Thanks for the quick response. It is a custom style. I know I can use dictConfig, but I do think that allowing the usage of fileConfig will solve a lot of trouble for people who are upgrading to 3.8.

@vsajip vsajip added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 11, 2020
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @vsajip for commit 930730a 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 11, 2020
Comment on lines 116 to 118
vld = True
if vldstr == "False":
vld = False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest this be simplified to vld = (vldstr != "False").

Copy link
Member

@vsajip vsajip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly a test could also be added for various values in the configuration.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Copy link
Member

@vsajip vsajip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I clicked on "Request changes", but for some reason the status has remained at "Awaiting review" ...

OK, it's changed now to "awaiting changes".

@mirii1994
Copy link
Author

@vsajip I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@vsajip: please review the changes made to this pull request.

@bedevere-bot bedevere-bot requested a review from vsajip July 12, 2020 16:17
Copy link
Member

@vsajip vsajip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about adding tests?

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@iritkatriel
Copy link
Member

This PR seems to have been abandoned by the OP. Shall we close it?

@iritkatriel iritkatriel added the pending The issue will be closed if no feedback is provided label Jun 25, 2022
@vsajip
Copy link
Member

vsajip commented Jun 26, 2022

This PR seems to have been abandoned by the OP. Shall we close it?

Yes, I'll do that.

@vsajip vsajip closed this Jun 26, 2022
@AA-Turner AA-Turner removed the pending The issue will be closed if no feedback is provided label Apr 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

Comments