Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Remove unnecessary double log #31699

Closed
wants to merge 1 commit into from

Conversation

yajo
Copy link
Contributor

@yajo yajo commented Mar 8, 2019

Before this patch, in #28612 a new feature was added that helped the admin to know what validation had actually failed when it happened.

It was needed in Odoo 10.0 because in Python 2, the exception didn't include the original traceback, but in Odoo 11+, with Python 3, PEP3134 saves us this need.

This new logger makes some downstream tests to fail if the testbots expect no ERROR messages; and in any case the logs can be confusing by logging an ERROR where there might be a except above in the call stack that expects and reacts to such failure.

To avoid all of this, let's revert 2b1d3ff in Python 3 versions of Odoo.

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
@Tecnativa @etobella

@yajo yajo force-pushed the 11.0-remove-unnecessary-logger branch from 0a413b3 to 5e4e746 Compare March 8, 2019 10:04
@yajo
Copy link
Contributor Author

yajo commented Mar 8, 2019

I forgot to mention that this would help downstream because in @OCA we check that there are no ERROR messages in the logs.

It's OK to fix the v10 branches, but for v11 it's a lot of work that's actually not going to add value because Python 3 does the dirty job by himself here.

Example PR that fixes our Travis: OCA/stock-logistics-warehouse#552

🙏 Please merge this for v11+.

Thanks!

@pedrobaeza
Copy link
Collaborator

@odony please check this as it's breaking all OCA constraints tests. In v10, we will need to do this any way, but the benefit is more than the harm, but for v11/v12, being unneeded, it's a pain.

Reverts 2b1d3ff introduced in 10.0 via

It was relatively useful in Odoo 10.0 because in Python 2 the exception
was missing a root cause traceback. But Python 3 includes exception
chaining by default, so it comes for free.
See [PEP3134](https://legacy.python.org/dev/peps/pep-3134/)

On top of being redundant in P3, it can also break some testcases
by causing an extra ERROR log entry, even when the final exception is
expected and caught. So it's simpler to remove it.
@odony odony force-pushed the 11.0-remove-unnecessary-logger branch from 5e4e746 to 96cd92f Compare March 8, 2019 11:07
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Mar 8, 2019
Copy link
Contributor

@odony odony left a comment

Choose a reason for hiding this comment

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

So double work, hmm? I think I made a mistake when I merged the patch in 10.0 in the first place - the risk/benefit ratio wasn't good. Even with very low risk (only impacts tests), the benefit was quite low too, so it was kind of a waste of energy (now twice). Let this serve as a reminder of merge policies and why they exist ;)

As for targeting 11.0, it's not pure P3 yet, but I guess it's acceptable that 11.0 on P2 gives slightly less detailed logs. I have slightly amended the commit to fix the format, so we can have robodoo merge it as is.

@robodoo r+

@robodoo robodoo added the r+ 👌 label Mar 8, 2019
@pedrobaeza
Copy link
Collaborator

Thanks for the quick reaction. There's no better option for everything...

robodoo pushed a commit that referenced this pull request Mar 8, 2019
Reverts 2b1d3ff introduced in 10.0 via

It was relatively useful in Odoo 10.0 because in Python 2 the exception
was missing a root cause traceback. But Python 3 includes exception
chaining by default, so it comes for free.
See [PEP3134](https://legacy.python.org/dev/peps/pep-3134/)

On top of being redundant in P3, it can also break some testcases
by causing an extra ERROR log entry, even when the final exception is
expected and caught. So it's simpler to remove it.

closes #31699

Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses merging 👷 and removed merging 👷 labels Mar 8, 2019
@robodoo
Copy link
Contributor

robodoo commented Mar 8, 2019

Merged, thanks!

@robodoo robodoo closed this Mar 8, 2019
@pedrobaeza pedrobaeza deleted the 11.0-remove-unnecessary-logger branch April 18, 2024 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI 🤖 Robodoo has seen passing statuses
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants