If a common message is not being used, they should each be treated separately with respect to choosing a marker function

Bug #1600788 reported by jingtao liang on 2016-07-11
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Low
weiweigu
Magnum
Undecided
weiweigu
OpenStack Dashboard (Horizon)
Undecided
Unassigned
Solum
Undecided
YaoZheng_ZTE
glance_store
Undecided
jingtao liang
neutron
Undecided
weiweigu
oslo.log
Undecided
jingtao liang

Bug Description

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

For example, do not do this:

# WRONG
LOG.exception(_('There was an error.'))
raise LocalExceptionClass(_('An error occured.'))
Instead, use this style:

# RIGHT
LOG.exception(_LE('There was an error.'))
raise LocalExceptionClass(_('An error occured.'))

And oslo.log has the problem,we shuld correct it.

Changed in oslo.log:
assignee: nobody → jingtao liang (liang-jingtao)
Changed in glance-store:
assignee: nobody → jingtao liang (liang-jingtao)

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

Changed in glance-store:
status: New → In Progress
Changed in oslo.log:
status: New → In Progress

Reviewed: https://review.openstack.org/340330
Committed: https://git.openstack.org/cgit/openstack/oslo.log/commit/?id=c426a42ccd9cab3a7c657684b025475b78f8c330
Submitter: Jenkins
Branch: master

commit c426a42ccd9cab3a7c657684b025475b78f8c330
Author: liangjingtao <email address hidden>
Date: Mon Jul 11 20:12:36 2016 +0800

    Replace "LOG.exception(_" with "LOG.exception(_LE"

    Follow http://docs.openstack.org/developer/oslo.i18n/guidelines.html:
    If a common message is not being used, they should each betreated
    separately with respect to choosing a marker function.So this patch
    is to fix it.

    Change-Id: I07945d82320d9faf6dc452d49722af610330b441
    Closes-Bug: #1600788

Changed in oslo.log:
status: In Progress → Fix Released
weiweigu (gu-weiwei) on 2016-07-12
Changed in oslo.i18n:
assignee: nobody → weiweigu (gu-weiwei)
Changed in ceilometer:
assignee: nobody → weiweigu (gu-weiwei)
weiweigu (gu-weiwei) on 2016-07-12
Changed in oslo.i18n:
status: New → Invalid

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

Changed in ceilometer:
status: New → In Progress
weiweigu (gu-weiwei) on 2016-07-12
Changed in cinder:
assignee: nobody → weiweigu (gu-weiwei)
Changed in solum:
assignee: nobody → YaoZheng_ZTE (zheng-yao1)
weiweigu (gu-weiwei) on 2016-07-12
Changed in cinder:
status: New → Invalid
weiweigu (gu-weiwei) on 2016-07-12
Changed in glance:
assignee: nobody → weiweigu (gu-weiwei)
Changed in horizon:
assignee: nobody → weiweigu (gu-weiwei)
Changed in keystone:
assignee: nobody → weiweigu (gu-weiwei)
weiweigu (gu-weiwei) on 2016-07-12
no longer affects: cinder
no longer affects: oslo.i18n
Changed in neutron:
assignee: nobody → weiweigu (gu-weiwei)

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

Changed in glance:
status: New → In Progress

This issue was fixed in the openstack/oslo.log 3.12.0 release.

Brandon Logan (brandon-logan) wrote :

for neutron, using the following grep does not return any violations:
$ grep -PRn --exclude-dir=.tox --exclude-dir=.testrepository 'LOG.exception\(_\(' .

Howver, there are some that create the message before doing the LOG.exception call and looks like some of those do the _(.

$ grep -PRn --exclude-dir=.tox --exclude-dir=.testrepository 'LOG.exception\([a-z]' .
./neutron/agent/linux/ip_lib.py:993: LOG.exception(msg, {'addr': address,
./neutron/agent/linux/iptables_manager.py:417: LOG.exception(msg)
./neutron/agent/l3/router_info.py:258: LOG.exception(msg)
./neutron/agent/l3/router_info.py:336: LOG.exception(msg)
./neutron/agent/l3/namespaces.py:83: LOG.exception(msg, self.name)
./neutron/agent/l3/dvr_local_router.py:319: LOG.exception(exc)
./neutron/agent/l3/agent.py:461: LOG.exception(msg, update.id)
./neutron/agent/l3/agent.py:484: LOG.exception(e.msg)
./neutron/agent/l3/agent.py:492: LOG.exception(msg, update.id)
./neutron/policy.py:207: LOG.exception(err_reason)

Changed in neutron:
status: New → Triaged
tags: added: low-hanging-fruit
Changed in glance:
importance: Undecided → Low

Reviewed: https://review.openstack.org/340894
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=14ccf5986e0423a2835c2c5be8c9a1246f0db2f3
Submitter: Jenkins
Branch: master

commit 14ccf5986e0423a2835c2c5be8c9a1246f0db2f3
Author: weiweigu <email address hidden>
Date: Tue Jul 12 21:12:04 2016 +0800

    Replace "LOG.warn(_" with "LOG.(_LW"

    Follow http://docs.openstack.org/developer/oslo.i18n/guidelines.html:
    If a common message is not being used, they should each betreated
    separately with respect to choosing a marker function.So this patch
    is to fix it.

    Change-Id: Id122aa6395c534bee5287264c8951181f08d6f19
    Closes-Bug: #1600788

Changed in glance:
status: In Progress → Fix Released
weiweigu (gu-weiwei) on 2016-07-15
no longer affects: keystone
weiweigu (gu-weiwei) on 2016-07-15
Changed in congress:
assignee: nobody → weiweigu (gu-weiwei)
Changed in magnum:
assignee: nobody → weiweigu (gu-weiwei)
weiweigu (gu-weiwei) on 2016-07-15
no longer affects: congress

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

Changed in magnum:
status: New → In Progress

Reviewed: https://review.openstack.org/342616
Committed: https://git.openstack.org/cgit/openstack/magnum/commit/?id=ec729d6cc686f0af5c79cfd24cac99fc3de215fd
Submitter: Jenkins
Branch: master

commit ec729d6cc686f0af5c79cfd24cac99fc3de215fd
Author: weiweigu <email address hidden>
Date: Fri Jul 15 15:26:02 2016 +0800

    Replace "LOG.info(_" with "LOG.info(_LI"

    Follow http://docs.openstack.org/developer/oslo.i18n/guidelines.html:
    If a common message is not being used, they should each betreated
    separately with respect to choosing a marker function.So this patch
    is to fix it.

    Change-Id: If7a74ce983ad0c7f4cab057cadd7d20ef3067fcd
    Closes-Bug: #1600788

Changed in magnum:
status: In Progress → Fix Released

Change abandoned by Nikhil Komawar (<email address hidden>) on branch: master
Review: https://review.openstack.org/340329
Reason: as per agreement

This issue was fixed in the openstack/magnum 3.0.0 release.

This issue was fixed in the openstack/glance 13.0.0.0b3 development milestone.

Change abandoned by gordon chung (<email address hidden>) on branch: master
Review: https://review.openstack.org/340693
Reason: stale

gordon chung (chungg) on 2016-11-02
no longer affects: ceilometer
Ian Cordasco (icordasc) on 2017-01-27
Changed in glance-store:
status: In Progress → Fix Released
Changed in horizon:
status: New → Confirmed
importance: Undecided → Low
milestone: none → next
Akihiro Motoki (amotoki) wrote :

Horizon does not use oslo.log for logging. Horizon depends on Django and logging is also handled via django and python standard logging. In the horizon messaging policy, logging messages are not translated and other user visible message are translated via django translation marker. (Note that _ has a different meaning in horizon.)

There were similar situation in horizon, but it was clean up as bug 1406333.

Marking this as Won't Fix in horizon. In horizon there is nothing to do more.

Changed in horizon:
status: Confirmed → Won't Fix
assignee: weiweigu (gu-weiwei) → nobody
milestone: next → none
importance: Low → Undecided
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers