misuse of log marker functions in neutron

Bug #1514193 reported by Haifeng.Yan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
Haifeng.Yan

Bug Description

ref http://docs.openstack.org/developer/oslo.i18n/guidelines.html

" The log marker functions (_LI(), _LW(), _LE(), and _LC()) must only be used when the message is only sent directly to the log. Anytime that the message will be passed outside of the current context (for example as part of an exception) the _() marker function must be used.
 "

and http://docs.openstack.org/developer/oslo.i18n/usage.html

"
except AnException1:

    # Log only
    LOG.exception(_LE('exception message'))

except AnException2:

    # Raise only
    raise RuntimeError(_('exception message'))

else:

    # Log and Raise
    msg = _('Unexpected error message')
    LOG.exception(msg)
    raise RuntimeError(msg)
"

there several misuses in neutron code now,
https://github.com/openstack/neutron/blob/master/neutron/agent/ovsdb/native/commands.py#L334
https://github.com/openstack/neutron/blob/master/neutron/agent/ovsdb/native/commands.py#L334
https://github.com/openstack/neutron/blob/master/neutron/agent/linux/iptables_manager.py#L406
...

Haifeng.Yan (yanheven)
tags: added: logging
Henry Gessau (gessau)
Changed in neutron:
status: New → Confirmed
importance: Undecided → Low
tags: added: low-hanging-fruit
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/242900

Changed in neutron:
assignee: nobody → yan.haifeng (yanheven)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/242900
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=313b6a4d5ce98251ad56e44e2eaaf5490dc27a51
Submitter: Jenkins
Branch: master

commit 313b6a4d5ce98251ad56e44e2eaaf5490dc27a51
Author: yan.haifeng <email address hidden>
Date: Mon Nov 9 10:27:54 2015 +0800

    Fix misuse of log marker functions in neutron

    some log marker functions misuse in neutron,
    ref http://docs.openstack.org/developer/oslo.i18n/guidelines.html
    and http://docs.openstack.org/developer/oslo.i18n/usage.html

    Change-Id: Ia7a539f9414c4aa9666fa62522083ef48950e093
    Closes-Bug: #1514193

Changed in neutron:
status: In Progress → Fix Committed
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/neutron 8.0.0.0b1

This issue was fixed in the openstack/neutron 8.0.0.0b1 development milestone.

Changed in neutron:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.