log_config_append disables existing loggers

Bug #1370439 reported by Daniele Venzano
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.log
Fix Released
Low
Brant Knudson

Bug Description

The description of the "log_config_append" says that the logging configuration provided in the file will be appended to any other existing logging option.

This is not the case, every other logging option I set in the configuration file is ignored, the if ... else in the setup() call in log.py prevents any other option to be used.

Either the documentation is wrong/confusing or the code is not doing what it is supposed to do.

I would like to have logs sent to logstash through a custom handler class, but also save them locally with log_dir.

Tags: doc
Revision history for this message
Doug Hellmann (doug-hellmann) wrote :

The option and its description are both poorly worded.

The intent is to allow you to have multiple logging configuration files outside of the main openstack configuration file. It is not to append that configuration to the configuration managed in the openstack configuration file. We assume if you are going to the trouble of setting up an external file, you will do *all* of the log configuration using that file.

We can clarify the help text for the option.

Changed in oslo.log:
milestone: none → next-kilo
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :

Doug,

Looking at why disable_existing_loggers=False was added, the following may not be right. something is fishy here....

"We assume if you are going to the trouble of setting up an external file, you will do *all* of the log configuration using that file."

https://review.openstack.org/#/c/28848/
https://bugs.launchpad.net/oslo-incubator/+bug/1169328
https://bugs.launchpad.net/oslo-incubator/+bug/1238349

the documentation also says the following:
disable_existing_loggers – If specified as False, loggers which exist when this call is made are left enabled. The default is True because this enables old behaviour in a backward- compatible way. This behaviour is to disable any existing loggers unless they or their ancestors are explicitly named in the logging configuration.

So it almost seems like we are doing the right thing with the name "log_config_append" and the code "disable_existing_loggers=False", BUT that's somehow not working for Daniele.

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

Daniele,

What do you have in your file that is not getting picked up. Can you please give a specific example?

thanks,
dims

Changed in oslo.log:
status: Triaged → Incomplete
Revision history for this message
Daniele Venzano (venza) wrote :

Hello,

I'm referring to options set in the Neutron/Nova/etc configuration files. If I define "log_config_append" anything else will be ignored.

The add_dir option is the best example. It provides a log file per-process, named correctly in the log directory. It is difficult to do the same with a custom python logging configuration. But also all the other options regarding logging will be ignored (debug, verbose, log_file, ...).

In log.py there is an "if" that prevents the options set in OpenStack configuration to be read if "log_config_append" is defined.
That "if" in the code and the "append" in the option name and documentation do not make sense together.

Thanks,
Daniele

Changed in oslo.log:
status: Incomplete → Confirmed
Changed in oslo.log:
milestone: next-kilo → none
tags: added: doc
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.log (master)

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

Changed in oslo.log:
assignee: nobody → Brant Knudson (blk-u)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.log (master)

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

commit 393467e4b858acd2bca9ee52ff2b630e746ffcf1
Author: Brant Knudson <email address hidden>
Date: Thu Sep 24 09:49:58 2015 -0500

    Update option docs for when log config is used

    When a logging configuration file is used (log_config_append is
    specified), then most of the config options don't apply since all
    the configuration is read from the config file rather than the
    options.

    Change-Id: I05a61acb221c62c22ea7830a63090657442e20be
    Closes-Bug: 1370439

Changed in oslo.log:
status: In Progress → Fix Committed
Changed in oslo.log:
milestone: none → 1.12.0
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.