Replace logging with oslo_log

If we use logging lib to initialize a logger, the logger won't be applied
the oslo_log config options.

Change-Id: Ib6bc686f4296cc335aa5abcc47f266a237d8688c
This commit is contained in:
liusheng 2016-04-25 11:39:47 +08:00
parent 68248fe540
commit 0267193cf2
4 changed files with 7 additions and 11 deletions

View File

@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import logging
import os import os
from oslo_config import cfg from oslo_config import cfg
@ -108,7 +107,7 @@ def build_server():
LOG.info(_LI('Starting server in PID %s') % os.getpid()) LOG.info(_LI('Starting server in PID %s') % os.getpid())
LOG.info(_LI("Configuration:")) LOG.info(_LI("Configuration:"))
cfg.CONF.log_opt_values(LOG, logging.INFO) cfg.CONF.log_opt_values(LOG, log.INFO)
if host == '0.0.0.0': if host == '0.0.0.0':
LOG.info(_LI( LOG.info(_LI(

View File

@ -14,16 +14,15 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import logging
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log
from ceilometer.i18n import _LI from ceilometer.i18n import _LI
from ceilometer import service from ceilometer import service
from ceilometer import storage from ceilometer import storage
LOG = logging.getLogger(__name__) LOG = log.getLogger(__name__)
def dbsync(): def dbsync():

View File

@ -12,9 +12,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import logging
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log
import oslo_messaging import oslo_messaging
from stevedore import extension from stevedore import extension
@ -22,7 +21,7 @@ from ceilometer.event import converter as event_converter
from ceilometer.i18n import _LE from ceilometer.i18n import _LE
from ceilometer import messaging from ceilometer import messaging
LOG = logging.getLogger(__name__) LOG = log.getLogger(__name__)
class EventsNotificationEndpoint(object): class EventsNotificationEndpoint(object):

View File

@ -12,7 +12,6 @@
# under the License. # under the License.
import functools import functools
import logging
import novaclient import novaclient
from novaclient import client as nova_client from novaclient import client as nova_client
@ -66,8 +65,8 @@ class Client(object):
logger = None logger = None
if cfg.CONF.nova_http_log_debug: if cfg.CONF.nova_http_log_debug:
logger = logging.getLogger("novaclient-debug") logger = log.getLogger("novaclient-debug")
logger.setLevel(log.DEBUG) logger.logger.setLevel(log.DEBUG)
self.nova_client = nova_client.Client( self.nova_client = nova_client.Client(
version=2, version=2,