[openstack-dev] oslo_log/oslo_config initialization

Qiming Teng tengqim at linux.vnet.ibm.com
Thu Jan 22 04:23:20 UTC 2015


On Wed, Jan 21, 2015 at 10:17:38AM -0500, Doug Hellmann wrote:
> It looks like this is already worked out, but there is some advice in the oslo.log docs [1] that might be useful.
> 
> Also, it’s important to note that oslo.log is not officially released as a stable API yet, so be careful with adoption. We cut a quiet release to make testing with applications easier, but may need to modify the API before making an official announcement that it’s ready to be used.
> 
> Doug
> 
> [1] http://docs.openstack.org/developer/oslo.log/usage.html#in-an-application

Doug, thank you for the reply.

I did checked out the usage.html there, it is offering no help other
than confusion. If you do register_options(), you will definitely fail.
It will throw me back to the initial question about passing what kind of
a conf to setup() or register_options().

What I can do now is be patient and wait for a stable API/release. :)

Regards,
  Qiming

> > On Jan 21, 2015, at 9:38 AM, Qiming Teng <tengqim at linux.vnet.ibm.com> wrote:
> > 
> > On Wed, Jan 21, 2015 at 08:25:57AM -0500, Davanum Srinivas wrote:
> >> Qiming,
> >> 
> >> Nova already uses oslo.config. there's a patch against nova to use
> >> oslo_log. Doug took the effort to do this so we'd not face issues once
> >> we release oslo_log, so yes, they have been tested together. Please
> >> hop onto #openstack-oslo to debug in real time.
> >> 
> >> [1] https://review.openstack.org/#/c/147635/
> > 
> > Thanks, glad to know some projects already took the adventure and it
> > works.
> > 
> > Regards,
> >  Qiming
> > 
> >> On Wed, Jan 21, 2015 at 8:11 AM, Qiming Teng <tengqim at linux.vnet.ibm.com> wrote:
> >>> On Wed, Jan 21, 2015 at 12:27:15PM +0200, Denis Makogon wrote:
> >>>> On Wed, Jan 21, 2015 at 12:16 PM, Qiming Teng <tengqim at linux.vnet.ibm.com>
> >>>> wrote:
> >>>> 
> >>>>> Hi,
> >>>>> 
> >>>>> In the oslo_log 0.1.0 release, the setup() function demands for a conf
> >>>>> parameter, but I have failed to find any hint about setting this up.
> >>>>> 
> >>>>> The problem is cfg.CONF() returns None, so the following code fails:
> >>>>> 
> >>>>>  conf = cfg.CONF(name='prog', project='project')
> >>>>>  # conf is always None here, so the following call fails
> >>>>>  log.setup(conf, 'project')
> >>>>> 
> >>>>> Another attempt also failed, because it cannot find any options:
> >>>>> 
> >>>>>  log.setup(cfg.CONF, 'project')
> >>>>> 
> >>>>> Any hint or sample code to setup logging if I'm abandoning the log
> >>>>> module from oslo.incubator?
> >>>>> 
> >>>>> 
> >>>> You might take a look at
> >>>> https://github.com/openstack/oslo.log/blob/master/oslo_log/_options.py
> >>>> Those options are what oslo_log expects to find in service configuration
> >>>> files.
> >>> 
> >>> Okay, my guess is that both oslo_config and oslo_log are trying to
> >>> register_cli_options. I have to create a configuration object for
> >>> oslo_log to work, and it means CLI options are registered once.
> >>> Later on, when I'm calling log.register_options(), it is conflicting
> >>> with previous registration.
> >>> 
> >>> So, I'm doubting whether these two packages have been tested together?
> >>> 
> >>> Regards,
> >>>  Qiming
> >>> 
> >>>>> Regards,
> >>>>>  Qiming
> >>>>> 
> >>>>> 




More information about the OpenStack-dev mailing list