No good way to use LegacyFormatter for logging

Bug #1167388 reported by Andrew Laski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo-incubator
Fix Released
Medium
Andrew Laski

Bug Description

With https://review.openstack.org/#/c/24032/ there is not a great way to use the LegacyFormatter that's been the default for a while now. Because the option in the if check is set by default it is now always used. Unless the "log_format" option is set to an empty string in which case the LegacyFormatter is used, which is an unintuitive way to achieve that.

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :

Andrew, Any suggestions to make things better?

Revision history for this message
Andrew Laski (alaski) wrote :

I haven't come up with anything brilliant yet, but I'm thinking that maybe log_format can be deprecated or rolled into LegacyFormatter and all logging can be handled through the same class.

Or the log_format default can be changed to an empty string so the else clause is hit, though that's really just a workaround.

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :

Andrew,

Bottom line is that log_format wins as the other 2-3 options are considered "Legacy", did not go far back to figure out why that was done. If we go with the flow, that means anyone who needs "Legacy" should not have log_format in their conf file. So which means the only way to do this is to set log_format's default value to None....Unless we want to deprecreate log_format entirely and rename "Legacy". I am leaning towards the first solution. Let's see if anyone else chimes in. The other option is to set log_format to empty in the devstack which is what drove this bug in the first place.

-- dims

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo-incubator (master)

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

Changed in oslo:
assignee: nobody → Andrew Laski (alaski)
status: New → In Progress
Revision history for this message
Andrew Laski (alaski) wrote :

Davanum,

I think setting the log_format default to None or '' would be a fine solution to this. I just pushed a patch which attempts to solve this in a different way by allowing explicit specification of a formatter. This would allow other projects to customize as well without needing to clutter oslo with project specific formatters. I would love to hear feedback around moving in this direction.

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote : Re: [Bug 1167388] Re: No good way to use LegacyFormatter for logging

Looks good Andrew, i've left a few comments.

-- dims

On Thu, Apr 11, 2013 at 4:15 PM, Andrew Laski <email address hidden>wrote:

> Davanum,
>
> I think setting the log_format default to None or '' would be a fine
> solution to this. I just pushed a patch which attempts to solve this in
> a different way by allowing explicit specification of a formatter. This
> would allow other projects to customize as well without needing to
> clutter oslo with project specific formatters. I would love to hear
> feedback around moving in this direction.
>
> --
> You received this bug notification because you are a member of Oslo
> Core, which is subscribed to oslo.
> https://bugs.launchpad.net/bugs/1167388
>
> Title:
> No good way to use LegacyFormatter for logging
>
> Status in Oslo - a Library of Common OpenStack Code:
> In Progress
>
> Bug description:
> With https://review.openstack.org/#/c/24032/ there is not a great way
> to use the LegacyFormatter that's been the default for a while now.
> Because the option in the if check is set by default it is now always
> used. Unless the "log_format" option is set to an empty string in
> which case the LegacyFormatter is used, which is an unintuitive way to
> achieve that.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/oslo/+bug/1167388/+subscriptions
>

--
Davanum Srinivas :: http://davanum.wordpress.com

Mark McLoughlin (markmc)
Changed in oslo:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo-incubator (master)

Reviewed: https://review.openstack.org/26784
Committed: http://github.com/openstack/oslo-incubator/commit/060c0967dbd539fe2a218c22a5b385294e13959f
Submitter: Jenkins
Branch: master

commit 060c0967dbd539fe2a218c22a5b385294e13959f
Author: Andrew Laski <email address hidden>
Date: Wed May 1 14:29:23 2013 -0400

    Deprecate log_format and change default to None

    Commit 3e71cc4c8c7e08784f44c2e337a585e562b93ec5 fixed an issue with
    ignoring log_format, but changed the default logging formatter. This
    led to being unable to use the former context aware formatter without
    configuring log_format='' explicitly.

    This change sets log_format to None so that the default is a context
    aware formatter, but setting log_format works as intended.

    Additionally, since log_format is mutually exclusive with some of the
    other config formatting options, such as logging_default_format_string,
    it should be deprecated.

    Bug 1167388

    Change-Id: I281ed7fe3448403f27a4cd318fc21915027906cc

Changed in oslo:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in oslo:
milestone: none → havana-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in oslo:
milestone: havana-1 → 2013.2
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.