diff --git a/contrib/designate-ext-samplehandler/designate_ext_samplehandler/notification_handler/sample.py b/contrib/designate-ext-samplehandler/designate_ext_samplehandler/notification_handler/sample.py index 0027dd505..5099646a8 100644 --- a/contrib/designate-ext-samplehandler/designate_ext_samplehandler/notification_handler/sample.py +++ b/contrib/designate-ext-samplehandler/designate_ext_samplehandler/notification_handler/sample.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. from oslo.config import cfg +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate.objects import Record from designate.notification_handler.base import NotificationHandler diff --git a/designate/__init__.py b/designate/__init__.py index e1d0f5315..9c5f04cac 100644 --- a/designate/__init__.py +++ b/designate/__init__.py @@ -21,11 +21,10 @@ import os import socket from oslo.config import cfg +from oslo_log import log from oslo import messaging -cfg.CONF.import_opt('default_log_levels', 'designate.openstack.common.log') - cfg.CONF.register_opts([ cfg.StrOpt('host', default=socket.gethostname(), help='Name of this node'), @@ -52,17 +51,17 @@ cfg.CONF.register_opts([ ]) # Set some Oslo Log defaults -cfg.CONF.set_default('default_log_levels', - ['amqplib=WARN', - 'amqp=WARN', - 'sqlalchemy=WARN', - 'boto=WARN', - 'suds=INFO', - 'keystone=INFO', - 'eventlet.wsgi.server=WARN', - 'stevedore=WARN', - 'keystonemiddleware.auth_token=INFO', - 'oslo.messaging=WARN']) +log.set_defaults(default_log_levels=[ + 'amqplib=WARN', + 'amqp=WARN', + 'sqlalchemy=WARN', + 'boto=WARN', + 'suds=INFO', + 'keystone=INFO', + 'eventlet.wsgi.server=WARN', + 'stevedore=WARN', + 'keystonemiddleware.auth_token=INFO', + 'oslo.messaging=WARN']) # Set some Oslo RPC defaults messaging.set_transport_defaults('designate') diff --git a/designate/api/middleware.py b/designate/api/middleware.py index 6a3e6395d..85c02128f 100644 --- a/designate/api/middleware.py +++ b/designate/api/middleware.py @@ -17,6 +17,7 @@ import flask import webob.dec from oslo.config import cfg from oslo import messaging +from oslo_log import log as logging from oslo_middleware import base from oslo_middleware import request_id from oslo.serialization import jsonutils as json @@ -25,7 +26,6 @@ from oslo_utils import strutils from designate import exceptions from designate import notifications from designate import context -from designate.openstack.common import log as logging from designate.i18n import _LI from designate.i18n import _LW from designate.i18n import _LE diff --git a/designate/api/service.py b/designate/api/service.py index cff8a2bc2..7a4eb7bf1 100644 --- a/designate/api/service.py +++ b/designate/api/service.py @@ -13,10 +13,10 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from paste import deploy from oslo.config import cfg +from oslo_log import log as logging +from paste import deploy -from designate.openstack.common import log as logging from designate.i18n import _LI from designate import exceptions from designate import utils diff --git a/designate/api/v1/__init__.py b/designate/api/v1/__init__.py index 3a32002c3..116dea2de 100644 --- a/designate/api/v1/__init__.py +++ b/designate/api/v1/__init__.py @@ -21,9 +21,9 @@ from werkzeug import wrappers from werkzeug.routing import BaseConverter from werkzeug.routing import ValidationError from oslo.config import cfg +from oslo_log import log as logging from oslo.serialization import jsonutils -from designate.openstack.common import log as logging from designate import exceptions from designate import utils diff --git a/designate/api/v1/domains.py b/designate/api/v1/domains.py index 9ce96e5d7..290e3ccdd 100644 --- a/designate/api/v1/domains.py +++ b/designate/api/v1/domains.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. import flask +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import schema from designate.api.v1 import load_values from designate.central import rpcapi as central_rpcapi diff --git a/designate/api/v1/extensions/diagnostics.py b/designate/api/v1/extensions/diagnostics.py index 00243952d..e886e0a7c 100644 --- a/designate/api/v1/extensions/diagnostics.py +++ b/designate/api/v1/extensions/diagnostics.py @@ -15,8 +15,8 @@ # under the License. import flask from oslo import messaging +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import rpc diff --git a/designate/api/v1/extensions/quotas.py b/designate/api/v1/extensions/quotas.py index d6dee8b11..74d1a1589 100644 --- a/designate/api/v1/extensions/quotas.py +++ b/designate/api/v1/extensions/quotas.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. import flask +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate.central import rpcapi as central_rpcapi diff --git a/designate/api/v1/extensions/reports.py b/designate/api/v1/extensions/reports.py index 72dfeae0d..e071f50c7 100644 --- a/designate/api/v1/extensions/reports.py +++ b/designate/api/v1/extensions/reports.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. import flask +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate.central import rpcapi as central_rpcapi diff --git a/designate/api/v1/extensions/sync.py b/designate/api/v1/extensions/sync.py index 5d1dd4d4e..2df0ec2b0 100644 --- a/designate/api/v1/extensions/sync.py +++ b/designate/api/v1/extensions/sync.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. import flask +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate.central import rpcapi as central_rpcapi diff --git a/designate/api/v1/limits.py b/designate/api/v1/limits.py index 4383ba200..ad741a91b 100644 --- a/designate/api/v1/limits.py +++ b/designate/api/v1/limits.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. import flask +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import schema from designate.central import rpcapi as central_rpcapi diff --git a/designate/api/v1/records.py b/designate/api/v1/records.py index 2a722f07d..bdf583dab 100644 --- a/designate/api/v1/records.py +++ b/designate/api/v1/records.py @@ -14,9 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. import flask +from oslo_log import log as logging from designate.central import rpcapi as central_rpcapi -from designate.openstack.common import log as logging from designate import exceptions from designate import objects from designate import schema diff --git a/designate/api/v1/servers.py b/designate/api/v1/servers.py index b27d443cd..bf5c5b82c 100644 --- a/designate/api/v1/servers.py +++ b/designate/api/v1/servers.py @@ -15,8 +15,8 @@ # under the License. import flask from oslo.config import cfg +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import exceptions from designate import schema from designate import objects diff --git a/designate/api/v1/tsigkeys.py b/designate/api/v1/tsigkeys.py index 75a027fc7..7f49c7656 100644 --- a/designate/api/v1/tsigkeys.py +++ b/designate/api/v1/tsigkeys.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. import flask +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import schema from designate.central import rpcapi as central_rpcapi from designate.objects import TsigKey diff --git a/designate/api/v2/__init__.py b/designate/api/v2/__init__.py index 216ed13db..850cf66d5 100644 --- a/designate/api/v2/__init__.py +++ b/designate/api/v2/__init__.py @@ -15,9 +15,9 @@ # under the License. import pecan.deploy from oslo.config import cfg +from oslo_log import log as logging from designate.api.v2 import patches # flake8: noqa -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/api/v2/app.py b/designate/api/v2/app.py index db686b905..bd8d5dc6f 100644 --- a/designate/api/v2/app.py +++ b/designate/api/v2/app.py @@ -16,9 +16,9 @@ import pecan import pecan.deploy from oslo.config import cfg +from oslo_log import log as logging from designate.api.v2 import patches -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/api/v2/controllers/blacklists.py b/designate/api/v2/controllers/blacklists.py index 4f6118f1d..a4b28b5c5 100644 --- a/designate/api/v2/controllers/blacklists.py +++ b/designate/api/v2/controllers/blacklists.py @@ -15,8 +15,8 @@ # under the License. import pecan +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import schema from designate import utils from designate.api.v2.controllers import rest diff --git a/designate/api/v2/controllers/errors.py b/designate/api/v2/controllers/errors.py index 0f8cd6b06..8518e7032 100644 --- a/designate/api/v2/controllers/errors.py +++ b/designate/api/v2/controllers/errors.py @@ -14,10 +14,10 @@ # License for the specific language governing permissions and limitations # under the License. -from designate import exceptions -from designate.openstack.common import log as logging - from pecan import expose +from oslo_log import log as logging + +from designate import exceptions LOG = logging.getLogger(__name__) diff --git a/designate/api/v2/controllers/extensions/counts.py b/designate/api/v2/controllers/extensions/counts.py index 3587e5d4e..0c8bb7023 100644 --- a/designate/api/v2/controllers/extensions/counts.py +++ b/designate/api/v2/controllers/extensions/counts.py @@ -15,8 +15,8 @@ # under the License. import pecan +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate.api.v2.controllers import rest from designate.api.v2.views.extensions import reports as reports_view diff --git a/designate/api/v2/controllers/extensions/quotas.py b/designate/api/v2/controllers/extensions/quotas.py index 38625272e..91b4f80f5 100644 --- a/designate/api/v2/controllers/extensions/quotas.py +++ b/designate/api/v2/controllers/extensions/quotas.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. import pecan +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import schema from designate.api.v2.controllers import rest from designate.api.v2.views.extensions import quotas as quotas_view diff --git a/designate/api/v2/controllers/extensions/reports.py b/designate/api/v2/controllers/extensions/reports.py index 2bcd0062e..b3b8d3189 100644 --- a/designate/api/v2/controllers/extensions/reports.py +++ b/designate/api/v2/controllers/extensions/reports.py @@ -14,7 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -from designate.openstack.common import log as logging +from oslo_log import log as logging + from designate.api.v2.controllers import rest from designate.api.v2.controllers.extensions import counts from designate.api.v2.controllers.extensions import tenants diff --git a/designate/api/v2/controllers/extensions/tenants.py b/designate/api/v2/controllers/extensions/tenants.py index 7b5bac155..8d1f8d213 100644 --- a/designate/api/v2/controllers/extensions/tenants.py +++ b/designate/api/v2/controllers/extensions/tenants.py @@ -15,8 +15,8 @@ # under the License. import pecan +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate.api.v2.controllers import rest from designate.api.v2.views.extensions import reports as reports_view diff --git a/designate/api/v2/controllers/limits.py b/designate/api/v2/controllers/limits.py index 480f889dd..4db43a5d3 100644 --- a/designate/api/v2/controllers/limits.py +++ b/designate/api/v2/controllers/limits.py @@ -15,8 +15,8 @@ # under the License. import pecan +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate.api.v2.controllers import rest from designate.api.v2.views import limits as limits_view diff --git a/designate/api/v2/controllers/nameservers.py b/designate/api/v2/controllers/nameservers.py index 5b147dfac..606d2ad3f 100644 --- a/designate/api/v2/controllers/nameservers.py +++ b/designate/api/v2/controllers/nameservers.py @@ -13,11 +13,10 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - import pecan +from oslo_log import log as logging from designate import utils -from designate.openstack.common import log as logging from designate.api.v2.controllers import rest from designate.api.v2.views import nameservers as nameservers_view diff --git a/designate/api/v2/controllers/pools.py b/designate/api/v2/controllers/pools.py index 7014fb7e8..2837fb450 100644 --- a/designate/api/v2/controllers/pools.py +++ b/designate/api/v2/controllers/pools.py @@ -13,8 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. import pecan +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import schema from designate import utils from designate.api.v2.controllers import rest diff --git a/designate/api/v2/controllers/recordsets.py b/designate/api/v2/controllers/recordsets.py index 2cac993fe..ebf2f09b7 100644 --- a/designate/api/v2/controllers/recordsets.py +++ b/designate/api/v2/controllers/recordsets.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. import pecan +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import exceptions from designate import schema from designate import utils diff --git a/designate/api/v2/controllers/rest.py b/designate/api/v2/controllers/rest.py index 2200c9dce..b2f1f4852 100644 --- a/designate/api/v2/controllers/rest.py +++ b/designate/api/v2/controllers/rest.py @@ -30,10 +30,10 @@ import six import pecan import pecan.rest import pecan.routing +from oslo_log import log as logging from designate import exceptions from designate.central import rpcapi as central_rpcapi -from designate.openstack.common import log as logging from designate.i18n import _ diff --git a/designate/api/v2/controllers/root.py b/designate/api/v2/controllers/root.py index e96c0d274..2c999b783 100644 --- a/designate/api/v2/controllers/root.py +++ b/designate/api/v2/controllers/root.py @@ -14,9 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. from oslo.config import cfg +from oslo_log import log as logging from stevedore import named -from designate.openstack.common import log as logging from designate.api.v2.controllers import limits from designate.api.v2.controllers import reverse from designate.api.v2.controllers import schemas diff --git a/designate/api/v2/controllers/schemas.py b/designate/api/v2/controllers/schemas.py index 6c730737f..11756630c 100644 --- a/designate/api/v2/controllers/schemas.py +++ b/designate/api/v2/controllers/schemas.py @@ -16,10 +16,10 @@ import os import pecan +from oslo_log import log as logging from designate import exceptions from designate import utils -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/api/v2/controllers/tlds.py b/designate/api/v2/controllers/tlds.py index 919c1fb68..9425751f4 100644 --- a/designate/api/v2/controllers/tlds.py +++ b/designate/api/v2/controllers/tlds.py @@ -13,8 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. import pecan +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import schema from designate import utils from designate.api.v2.controllers import rest diff --git a/designate/api/v2/controllers/zones/tasks/__init__.py b/designate/api/v2/controllers/zones/tasks/__init__.py index 989d67c0a..a6c5910d5 100644 --- a/designate/api/v2/controllers/zones/tasks/__init__.py +++ b/designate/api/v2/controllers/zones/tasks/__init__.py @@ -13,12 +13,13 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from designate.api.v2.controllers import rest from designate.api.v2.controllers.zones.tasks.transfer_requests \ import TransferRequestsController as TRC from designate.api.v2.controllers.zones.tasks.transfer_accepts \ import TransferAcceptsController as TRA -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/api/v2/controllers/zones/tasks/transfer_accepts.py b/designate/api/v2/controllers/zones/tasks/transfer_accepts.py index 8c66cbce9..bdafe7cbd 100644 --- a/designate/api/v2/controllers/zones/tasks/transfer_accepts.py +++ b/designate/api/v2/controllers/zones/tasks/transfer_accepts.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. import pecan +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import schema from designate import utils from designate.api.v2.controllers import rest diff --git a/designate/api/v2/controllers/zones/tasks/transfer_requests.py b/designate/api/v2/controllers/zones/tasks/transfer_requests.py index caf575b83..90b3455c3 100644 --- a/designate/api/v2/controllers/zones/tasks/transfer_requests.py +++ b/designate/api/v2/controllers/zones/tasks/transfer_requests.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. import pecan +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import schema from designate import utils from designate.api.v2.controllers import rest diff --git a/designate/api/v2/views/base.py b/designate/api/v2/views/base.py index 5c778f2a7..246a65389 100644 --- a/designate/api/v2/views/base.py +++ b/designate/api/v2/views/base.py @@ -16,10 +16,10 @@ import urllib from oslo.config import cfg +from oslo_log import log as logging from designate import exceptions from designate import objects -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/api/v2/views/blacklists.py b/designate/api/v2/views/blacklists.py index decdd1dfc..dc58252e1 100644 --- a/designate/api/v2/views/blacklists.py +++ b/designate/api/v2/views/blacklists.py @@ -14,8 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from designate.api.v2.views import base as base_view -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/api/v2/views/extensions/quotas.py b/designate/api/v2/views/extensions/quotas.py index 446ec64c2..573eabbb2 100644 --- a/designate/api/v2/views/extensions/quotas.py +++ b/designate/api/v2/views/extensions/quotas.py @@ -13,8 +13,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from designate.api.v2.views import base as base_view -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/api/v2/views/extensions/reports.py b/designate/api/v2/views/extensions/reports.py index 442555c0f..788a75d78 100644 --- a/designate/api/v2/views/extensions/reports.py +++ b/designate/api/v2/views/extensions/reports.py @@ -13,8 +13,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from designate.api.v2.views import base as base_view -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/api/v2/views/floatingips.py b/designate/api/v2/views/floatingips.py index 4bd31dbbe..ea8dfdb1b 100644 --- a/designate/api/v2/views/floatingips.py +++ b/designate/api/v2/views/floatingips.py @@ -13,8 +13,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from designate.api.v2.views import base as base_view -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/api/v2/views/limits.py b/designate/api/v2/views/limits.py index 4f8899ad0..bb6412677 100644 --- a/designate/api/v2/views/limits.py +++ b/designate/api/v2/views/limits.py @@ -13,8 +13,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from designate.api.v2.views import base as base_view -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/api/v2/views/nameservers.py b/designate/api/v2/views/nameservers.py index e80fffea5..eaa26cfa8 100644 --- a/designate/api/v2/views/nameservers.py +++ b/designate/api/v2/views/nameservers.py @@ -14,8 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from designate.api.v2.views import base as base_view -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/api/v2/views/pools.py b/designate/api/v2/views/pools.py index ec2148cdb..8ed8f33ca 100644 --- a/designate/api/v2/views/pools.py +++ b/designate/api/v2/views/pools.py @@ -12,9 +12,10 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from designate import objects from designate.api.v2.views import base as base_view -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/api/v2/views/recordsets.py b/designate/api/v2/views/recordsets.py index e2c5e2c15..9c4a2cb04 100644 --- a/designate/api/v2/views/recordsets.py +++ b/designate/api/v2/views/recordsets.py @@ -13,9 +13,10 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from designate import objects from designate.api.v2.views import base as base_view -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/api/v2/views/tlds.py b/designate/api/v2/views/tlds.py index 7d833ff4c..7a167ad60 100644 --- a/designate/api/v2/views/tlds.py +++ b/designate/api/v2/views/tlds.py @@ -12,8 +12,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from designate.api.v2.views import base as base_view -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/api/v2/views/zones/__init__.py b/designate/api/v2/views/zones/__init__.py index 97da9274e..27b7f24af 100644 --- a/designate/api/v2/views/zones/__init__.py +++ b/designate/api/v2/views/zones/__init__.py @@ -13,8 +13,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from designate.api.v2.views import base as base_view -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/api/v2/views/zones/tasks/transfer_accepts.py b/designate/api/v2/views/zones/tasks/transfer_accepts.py index 5205bcd50..3e8fe50a6 100644 --- a/designate/api/v2/views/zones/tasks/transfer_accepts.py +++ b/designate/api/v2/views/zones/tasks/transfer_accepts.py @@ -13,8 +13,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from designate.api.v2.views import base as base_view -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/api/v2/views/zones/tasks/transfer_requests.py b/designate/api/v2/views/zones/tasks/transfer_requests.py index c0ea6b66a..576f7894c 100644 --- a/designate/api/v2/views/zones/tasks/transfer_requests.py +++ b/designate/api/v2/views/zones/tasks/transfer_requests.py @@ -13,8 +13,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from designate.api.v2.views import base as base_view -from designate.openstack.common import log as logging from designate import exceptions from designate import policy diff --git a/designate/backend/__init__.py b/designate/backend/__init__.py index d6f31d4c7..c17feda24 100644 --- a/designate/backend/__init__.py +++ b/designate/backend/__init__.py @@ -13,7 +13,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from designate.openstack.common import log as logging +from oslo_log import log as logging + from designate.backend.base import PoolBackend LOG = logging.getLogger(__name__) diff --git a/designate/backend/base.py b/designate/backend/base.py index 82fd5e86d..e81b30bda 100644 --- a/designate/backend/base.py +++ b/designate/backend/base.py @@ -17,8 +17,8 @@ import abc import copy from oslo.config import cfg +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate.i18n import _LW from designate import exceptions from designate.context import DesignateContext diff --git a/designate/backend/impl_bind9.py b/designate/backend/impl_bind9.py index 08a276efe..766a92e4f 100644 --- a/designate/backend/impl_bind9.py +++ b/designate/backend/impl_bind9.py @@ -16,8 +16,8 @@ import socket from oslo.config import cfg +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import exceptions from designate import utils from designate.backend import base diff --git a/designate/backend/impl_dynect.py b/designate/backend/impl_dynect.py index 6c97f7768..390d1fb19 100644 --- a/designate/backend/impl_dynect.py +++ b/designate/backend/impl_dynect.py @@ -18,13 +18,13 @@ import time from eventlet import Timeout from oslo.config import cfg +from oslo_log import log as logging import requests from requests.adapters import HTTPAdapter from designate import exceptions from designate import utils from designate.backend import base -from designate.openstack.common import log as logging from designate.i18n import _LI from designate.i18n import _LW diff --git a/designate/backend/impl_fake.py b/designate/backend/impl_fake.py index eed39ca08..44ad5eb32 100644 --- a/designate/backend/impl_fake.py +++ b/designate/backend/impl_fake.py @@ -13,7 +13,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from designate.openstack.common import log as logging +from oslo_log import log as logging + from designate.i18n import _LI from designate.backend import base diff --git a/designate/backend/impl_ipa/__init__.py b/designate/backend/impl_ipa/__init__.py index 5ca9be9f6..c1576c413 100644 --- a/designate/backend/impl_ipa/__init__.py +++ b/designate/backend/impl_ipa/__init__.py @@ -18,11 +18,11 @@ import time import requests from oslo.config import cfg +from oslo_log import log as logging from oslo.serialization import jsonutils as json from oslo_utils import importutils from designate import exceptions -from designate.openstack.common import log as logging from designate.backend import base from designate.i18n import _LE diff --git a/designate/backend/impl_nsd4slave.py b/designate/backend/impl_nsd4slave.py index 04ee8048f..76970f20f 100644 --- a/designate/backend/impl_nsd4slave.py +++ b/designate/backend/impl_nsd4slave.py @@ -20,10 +20,10 @@ import ssl import eventlet from oslo.config import cfg +from oslo_log import log as logging from designate import exceptions from designate.backend import base -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/backend/impl_powerdns/__init__.py b/designate/backend/impl_powerdns/__init__.py index c28b540bf..6e98ea216 100644 --- a/designate/backend/impl_powerdns/__init__.py +++ b/designate/backend/impl_powerdns/__init__.py @@ -17,10 +17,10 @@ import copy import threading from oslo_db import options +from oslo_log import log as logging from oslo_utils import excutils from sqlalchemy.sql import select -from designate.openstack.common import log as logging from designate import exceptions from designate.i18n import _LC from designate.backend import base diff --git a/designate/backend/impl_powerdns/migrate_repo/versions/006_add_inherit_ttl_col.py b/designate/backend/impl_powerdns/migrate_repo/versions/006_add_inherit_ttl_col.py index cfe7fa850..68045897f 100644 --- a/designate/backend/impl_powerdns/migrate_repo/versions/006_add_inherit_ttl_col.py +++ b/designate/backend/impl_powerdns/migrate_repo/versions/006_add_inherit_ttl_col.py @@ -14,9 +14,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging from sqlalchemy import MetaData, Table, Column, Boolean -from designate.openstack.common import log as logging from designate.i18n import _LW diff --git a/designate/central/rpcapi.py b/designate/central/rpcapi.py index d2f857a6d..58b1dd780 100644 --- a/designate/central/rpcapi.py +++ b/designate/central/rpcapi.py @@ -14,9 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. from oslo.config import cfg +from oslo_log import log as logging from oslo import messaging -from designate.openstack.common import log as logging from designate.i18n import _LI from designate import rpc diff --git a/designate/central/service.py b/designate/central/service.py index 1de7aefc1..cae270019 100644 --- a/designate/central/service.py +++ b/designate/central/service.py @@ -24,10 +24,10 @@ import random from oslo.config import cfg from oslo import messaging +from oslo_log import log as logging from oslo_utils import excutils from oslo_concurrency import lockutils -from designate.openstack.common import log as logging from designate.i18n import _LI from designate.i18n import _LC from designate import context as dcontext diff --git a/designate/cmd/api.py b/designate/cmd/api.py index b07af6387..22b5bf394 100644 --- a/designate/cmd/api.py +++ b/designate/cmd/api.py @@ -16,8 +16,8 @@ import sys from oslo.config import cfg +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate.openstack.common import service from designate import rpc from designate import utils @@ -30,7 +30,7 @@ CONF.import_opt('workers', 'designate.api', group='service:api') def main(): utils.read_config('designate', sys.argv) - logging.setup('designate') + logging.setup(CONF, 'designate') rpc.init(CONF) diff --git a/designate/cmd/central.py b/designate/cmd/central.py index e129dabf5..8195590f1 100644 --- a/designate/cmd/central.py +++ b/designate/cmd/central.py @@ -16,8 +16,8 @@ import sys from oslo.config import cfg +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import service from designate import utils from designate.central import service as central @@ -29,7 +29,7 @@ CONF.import_opt('workers', 'designate.central', group='service:central') def main(): utils.read_config('designate', sys.argv) - logging.setup('designate') + logging.setup(CONF, 'designate') server = central.Service.create(binary='designate-central', service_name='central') diff --git a/designate/cmd/manage.py b/designate/cmd/manage.py index 99c707f1d..428f86529 100644 --- a/designate/cmd/manage.py +++ b/designate/cmd/manage.py @@ -20,11 +20,11 @@ import sys import eventlet from oslo.config import cfg +from oslo_log import log as logging from stevedore.extension import ExtensionManager from designate import utils from designate.i18n import _ -from designate.openstack.common import log as logging eventlet.monkey_patch(os=False) @@ -105,7 +105,7 @@ def main(): try: utils.read_config('designate', sys.argv) - logging.setup("designate") + logging.setup(CONF, 'designate') except cfg.ConfigFilesNotFoundError: cfgfile = CONF.config_file[-1] if CONF.config_file else None if cfgfile and not os.access(cfgfile, os.R_OK): diff --git a/designate/cmd/mdns.py b/designate/cmd/mdns.py index bc2827a00..795ba1fa7 100644 --- a/designate/cmd/mdns.py +++ b/designate/cmd/mdns.py @@ -16,8 +16,8 @@ import sys from oslo.config import cfg +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import service from designate import utils from designate.mdns import service as mdns_service @@ -29,7 +29,7 @@ CONF.import_opt('workers', 'designate.mdns', group='service:mdns') def main(): utils.read_config('designate', sys.argv) - logging.setup('designate') + logging.setup(CONF, 'designate') server = mdns_service.Service.create( binary='designate-mdns') diff --git a/designate/cmd/pool_manager.py b/designate/cmd/pool_manager.py index 4514c3b29..9261d2b81 100644 --- a/designate/cmd/pool_manager.py +++ b/designate/cmd/pool_manager.py @@ -16,10 +16,10 @@ import sys from oslo.config import cfg +from oslo_log import log as logging from designate import service from designate import utils -from designate.openstack.common import log as logging from designate.pool_manager import service as pool_manager_service @@ -30,7 +30,7 @@ CONF.import_opt('workers', 'designate.pool_manager', def main(): utils.read_config('designate', sys.argv) - logging.setup('designate') + logging.setup(CONF, 'designate') server = pool_manager_service.Service.create( binary='designate-pool-manager') diff --git a/designate/cmd/sink.py b/designate/cmd/sink.py index f43c31aad..0b57fdef5 100644 --- a/designate/cmd/sink.py +++ b/designate/cmd/sink.py @@ -16,8 +16,8 @@ import sys from oslo.config import cfg +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import service from designate import utils from designate.sink import service as sink_service @@ -29,7 +29,7 @@ CONF.import_opt('workers', 'designate.sink', group='service:sink') def main(): utils.read_config('designate', sys.argv) - logging.setup('designate') + logging.setup(CONF, 'designate') server = sink_service.Service() service.serve(server, workers=CONF['service:sink'].workers) diff --git a/designate/context.py b/designate/context.py index ff5fa28cc..475b187ea 100644 --- a/designate/context.py +++ b/designate/context.py @@ -17,9 +17,9 @@ import itertools import copy from oslo_context import context +from oslo_log import log as logging from designate.openstack.common import local -from designate.openstack.common import log as logging from designate import policy diff --git a/designate/manage/database.py b/designate/manage/database.py index 5012f021e..07b35e32c 100644 --- a/designate/manage/database.py +++ b/designate/manage/database.py @@ -17,8 +17,8 @@ import os from migrate.versioning import api as versioning_api from oslo.config import cfg +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate.manage import base from designate.sqlalchemy import utils diff --git a/designate/manage/pool_manager_cache.py b/designate/manage/pool_manager_cache.py index 55b32d101..7b1dbec12 100644 --- a/designate/manage/pool_manager_cache.py +++ b/designate/manage/pool_manager_cache.py @@ -17,8 +17,8 @@ import os from migrate.versioning import api as versioning_api from oslo.config import cfg +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate.manage import base from designate.sqlalchemy import utils diff --git a/designate/manage/powerdns.py b/designate/manage/powerdns.py index 44918b536..683b35cc9 100644 --- a/designate/manage/powerdns.py +++ b/designate/manage/powerdns.py @@ -18,8 +18,8 @@ import os from migrate.versioning import api as versioning_api from oslo.config import cfg from oslo_db.sqlalchemy.migration_cli import manager as migration_manager +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate.manage import base from designate import utils diff --git a/designate/manage/tlds.py b/designate/manage/tlds.py index e1669ae66..77ae008a4 100644 --- a/designate/manage/tlds.py +++ b/designate/manage/tlds.py @@ -16,11 +16,11 @@ import csv import os from oslo.config import cfg +from oslo_log import log as logging from designate import exceptions from designate import rpc from designate.central import rpcapi as central_rpcapi -from designate.openstack.common import log as logging from designate.i18n import _LI from designate.i18n import _LE from designate.manage import base diff --git a/designate/mdns/handler.py b/designate/mdns/handler.py index 885323e4b..d33aab89d 100644 --- a/designate/mdns/handler.py +++ b/designate/mdns/handler.py @@ -15,10 +15,10 @@ # under the License. import dns from oslo.config import cfg +from oslo_log import log as logging from designate import exceptions from designate import storage -from designate.openstack.common import log as logging from designate.i18n import _LE diff --git a/designate/mdns/notify.py b/designate/mdns/notify.py index 5a214e5c6..10988127f 100644 --- a/designate/mdns/notify.py +++ b/designate/mdns/notify.py @@ -17,9 +17,9 @@ import time import dns from oslo import messaging from oslo.config import cfg +from oslo_log import log as logging from designate.pool_manager import rpcapi as pool_mngr_api -from designate.openstack.common import log as logging from designate.i18n import _LI from designate.i18n import _LW diff --git a/designate/mdns/rpcapi.py b/designate/mdns/rpcapi.py index 467c7ff1b..be4c9354e 100644 --- a/designate/mdns/rpcapi.py +++ b/designate/mdns/rpcapi.py @@ -13,9 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. from oslo.config import cfg +from oslo_log import log as logging from oslo import messaging -from designate.openstack.common import log as logging from designate.i18n import _LI from designate import rpc diff --git a/designate/mdns/service.py b/designate/mdns/service.py index 3f6357a55..470de49ce 100644 --- a/designate/mdns/service.py +++ b/designate/mdns/service.py @@ -18,12 +18,12 @@ import struct import dns from oslo.config import cfg +from oslo_log import log as logging from designate import service from designate.mdns import handler from designate.mdns import middleware from designate.mdns import notify -from designate.openstack.common import log as logging from designate.i18n import _LE from designate.i18n import _LI from designate.i18n import _LW diff --git a/designate/network_api/base.py b/designate/network_api/base.py index 566a332c0..67985c358 100644 --- a/designate/network_api/base.py +++ b/designate/network_api/base.py @@ -15,10 +15,10 @@ # under the License. from dns import reversename from oslo.config import cfg +from oslo_log import log as logging from designate import exceptions from designate.plugin import DriverPlugin -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/network_api/fake.py b/designate/network_api/fake.py index 731552031..b5041b4a7 100644 --- a/designate/network_api/fake.py +++ b/designate/network_api/fake.py @@ -15,11 +15,12 @@ # under the License. import uuid -from designate.openstack.common import log +from oslo_log import log as logging + from designate.network_api.base import NetworkAPI -LOG = log.getLogger(__name__) +LOG = logging.getLogger(__name__) POOL = dict([(str(uuid.uuid4()), '192.168.2.%s' % i) for i in xrange(0, 254)]) ALLOCATIONS = {} diff --git a/designate/network_api/neutron.py b/designate/network_api/neutron.py index c01eb79d3..96d01e922 100644 --- a/designate/network_api/neutron.py +++ b/designate/network_api/neutron.py @@ -20,9 +20,9 @@ from neutronclient.v2_0 import client as clientv20 from neutronclient.common import exceptions as neutron_exceptions from oslo.config import cfg +from oslo_log import log as logging from designate import exceptions -from designate.openstack.common import log as logging from designate.openstack.common import threadgroup from designate.i18n import _LW from designate.i18n import _LE diff --git a/designate/notification_handler/base.py b/designate/notification_handler/base.py index ab03e2a01..d1ea762bd 100644 --- a/designate/notification_handler/base.py +++ b/designate/notification_handler/base.py @@ -17,9 +17,9 @@ import abc from oslo.config import cfg +from oslo_log import log as logging from designate import exceptions -from designate.openstack.common import log as logging from designate.central import rpcapi as central_rpcapi from designate.context import DesignateContext from designate.objects import Record diff --git a/designate/notification_handler/neutron.py b/designate/notification_handler/neutron.py index 54322d6de..421183acb 100644 --- a/designate/notification_handler/neutron.py +++ b/designate/notification_handler/neutron.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. from oslo.config import cfg +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate.notification_handler.base import BaseAddressHandler diff --git a/designate/notification_handler/nova.py b/designate/notification_handler/nova.py index 8d0d466fd..71750cbfe 100644 --- a/designate/notification_handler/nova.py +++ b/designate/notification_handler/nova.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. from oslo.config import cfg +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate.notification_handler.base import BaseAddressHandler diff --git a/designate/notifications.py b/designate/notifications.py index 929648b0f..93bd3621b 100644 --- a/designate/notifications.py +++ b/designate/notifications.py @@ -17,8 +17,8 @@ # Copied: nova.notifications from oslo.config import cfg +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import rpc LOG = logging.getLogger(__name__) diff --git a/designate/objects/base.py b/designate/objects/base.py index 819326df8..8ae009183 100644 --- a/designate/objects/base.py +++ b/designate/objects/base.py @@ -17,8 +17,8 @@ import urlparse import six import jsonschema +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import exceptions from designate.schema import validators from designate.schema import format diff --git a/designate/openstack/common/eventlet_backdoor.py b/designate/openstack/common/eventlet_backdoor.py index 8a403cc08..bfa3fd325 100644 --- a/designate/openstack/common/eventlet_backdoor.py +++ b/designate/openstack/common/eventlet_backdoor.py @@ -29,9 +29,9 @@ import eventlet import eventlet.backdoor import greenlet from oslo.config import cfg +from oslo_log import log as logging from designate.openstack.common._i18n import _LI -from designate.openstack.common import log as logging help_for_backdoor_port = ( "Acceptable values are 0, , and :, where 0 results " diff --git a/designate/openstack/common/log.py b/designate/openstack/common/log.py deleted file mode 100644 index 8888739fd..000000000 --- a/designate/openstack/common/log.py +++ /dev/null @@ -1,718 +0,0 @@ -# Copyright 2011 OpenStack Foundation. -# Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -"""OpenStack logging handler. - -This module adds to logging functionality by adding the option to specify -a context object when calling the various log methods. If the context object -is not specified, default formatting is used. Additionally, an instance uuid -may be passed as part of the log message, which is intended to make it easier -for admins to find messages related to a specific instance. - -It also allows setting of formatting information through conf. - -""" - -import copy -import inspect -import itertools -import logging -import logging.config -import logging.handlers -import os -import socket -import sys -import traceback - -from oslo.config import cfg -from oslo.serialization import jsonutils -from oslo.utils import importutils -import six -from six import moves - -_PY26 = sys.version_info[0:2] == (2, 6) - -from designate.openstack.common._i18n import _ -from designate.openstack.common import local - - -_DEFAULT_LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S" - - -common_cli_opts = [ - cfg.BoolOpt('debug', - short='d', - default=False, - help='Print debugging output (set logging level to ' - 'DEBUG instead of default WARNING level).'), - cfg.BoolOpt('verbose', - short='v', - default=False, - help='Print more verbose output (set logging level to ' - 'INFO instead of default WARNING level).'), -] - -logging_cli_opts = [ - cfg.StrOpt('log-config-append', - metavar='PATH', - deprecated_name='log-config', - help='The name of a logging configuration file. This file ' - 'is appended to any existing logging configuration ' - 'files. For details about logging configuration files, ' - 'see the Python logging module documentation.'), - cfg.StrOpt('log-format', - metavar='FORMAT', - help='DEPRECATED. ' - 'A logging.Formatter log message format string which may ' - 'use any of the available logging.LogRecord attributes. ' - 'This option is deprecated. Please use ' - 'logging_context_format_string and ' - 'logging_default_format_string instead.'), - cfg.StrOpt('log-date-format', - default=_DEFAULT_LOG_DATE_FORMAT, - metavar='DATE_FORMAT', - help='Format string for %%(asctime)s in log records. ' - 'Default: %(default)s .'), - cfg.StrOpt('log-file', - metavar='PATH', - deprecated_name='logfile', - help='(Optional) Name of log file to output to. ' - 'If no default is set, logging will go to stdout.'), - cfg.StrOpt('log-dir', - deprecated_name='logdir', - help='(Optional) The base directory used for relative ' - '--log-file paths.'), - cfg.BoolOpt('use-syslog', - default=False, - help='Use syslog for logging. ' - 'Existing syslog format is DEPRECATED during I, ' - 'and will change in J to honor RFC5424.'), - cfg.BoolOpt('use-syslog-rfc-format', - # TODO(bogdando) remove or use True after existing - # syslog format deprecation in J - default=False, - help='(Optional) Enables or disables syslog rfc5424 format ' - 'for logging. If enabled, prefixes the MSG part of the ' - 'syslog message with APP-NAME (RFC5424). The ' - 'format without the APP-NAME is deprecated in I, ' - 'and will be removed in J.'), - cfg.StrOpt('syslog-log-facility', - default='LOG_USER', - help='Syslog facility to receive log lines.') -] - -generic_log_opts = [ - cfg.BoolOpt('use_stderr', - default=True, - help='Log output to standard error.') -] - -DEFAULT_LOG_LEVELS = ['amqp=WARN', 'amqplib=WARN', 'boto=WARN', - 'qpid=WARN', 'sqlalchemy=WARN', 'suds=INFO', - 'oslo.messaging=INFO', 'iso8601=WARN', - 'requests.packages.urllib3.connectionpool=WARN', - 'urllib3.connectionpool=WARN', 'websocket=WARN', - "keystonemiddleware=WARN", "routes.middleware=WARN", - "stevedore=WARN"] - -log_opts = [ - cfg.StrOpt('logging_context_format_string', - default='%(asctime)s.%(msecs)03d %(process)d %(levelname)s ' - '%(name)s [%(request_id)s %(user_identity)s] ' - '%(instance)s%(message)s', - help='Format string to use for log messages with context.'), - cfg.StrOpt('logging_default_format_string', - default='%(asctime)s.%(msecs)03d %(process)d %(levelname)s ' - '%(name)s [-] %(instance)s%(message)s', - help='Format string to use for log messages without context.'), - cfg.StrOpt('logging_debug_format_suffix', - default='%(funcName)s %(pathname)s:%(lineno)d', - help='Data to append to log format when level is DEBUG.'), - cfg.StrOpt('logging_exception_prefix', - default='%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s ' - '%(instance)s', - help='Prefix each line of exception output with this format.'), - cfg.ListOpt('default_log_levels', - default=DEFAULT_LOG_LEVELS, - help='List of logger=LEVEL pairs.'), - cfg.BoolOpt('publish_errors', - default=False, - help='Enables or disables publication of error events.'), - cfg.BoolOpt('fatal_deprecations', - default=False, - help='Enables or disables fatal status of deprecations.'), - - # NOTE(mikal): there are two options here because sometimes we are handed - # a full instance (and could include more information), and other times we - # are just handed a UUID for the instance. - cfg.StrOpt('instance_format', - default='[instance: %(uuid)s] ', - help='The format for an instance that is passed with the log ' - 'message.'), - cfg.StrOpt('instance_uuid_format', - default='[instance: %(uuid)s] ', - help='The format for an instance UUID that is passed with the ' - 'log message.'), -] - -CONF = cfg.CONF -CONF.register_cli_opts(common_cli_opts) -CONF.register_cli_opts(logging_cli_opts) -CONF.register_opts(generic_log_opts) -CONF.register_opts(log_opts) - - -def list_opts(): - """Entry point for oslo.config-generator.""" - return [(None, copy.deepcopy(common_cli_opts)), - (None, copy.deepcopy(logging_cli_opts)), - (None, copy.deepcopy(generic_log_opts)), - (None, copy.deepcopy(log_opts)), - ] - - -# our new audit level -# NOTE(jkoelker) Since we synthesized an audit level, make the logging -# module aware of it so it acts like other levels. -logging.AUDIT = logging.INFO + 1 -logging.addLevelName(logging.AUDIT, 'AUDIT') - - -try: - NullHandler = logging.NullHandler -except AttributeError: # NOTE(jkoelker) NullHandler added in Python 2.7 - class NullHandler(logging.Handler): - def handle(self, record): - pass - - def emit(self, record): - pass - - def createLock(self): - self.lock = None - - -def _dictify_context(context): - if context is None: - return None - if not isinstance(context, dict) and getattr(context, 'to_dict', None): - context = context.to_dict() - return context - - -def _get_binary_name(): - return os.path.basename(inspect.stack()[-1][1]) - - -def _get_log_file_path(binary=None): - logfile = CONF.log_file - logdir = CONF.log_dir - - if logfile and not logdir: - return logfile - - if logfile and logdir: - return os.path.join(logdir, logfile) - - if logdir: - binary = binary or _get_binary_name() - return '%s.log' % (os.path.join(logdir, binary),) - - return None - - -class BaseLoggerAdapter(logging.LoggerAdapter): - - def audit(self, msg, *args, **kwargs): - self.log(logging.AUDIT, msg, *args, **kwargs) - - def isEnabledFor(self, level): - if _PY26: - # This method was added in python 2.7 (and it does the exact - # same logic, so we need to do the exact same logic so that - # python 2.6 has this capability as well). - return self.logger.isEnabledFor(level) - else: - return super(BaseLoggerAdapter, self).isEnabledFor(level) - - -class LazyAdapter(BaseLoggerAdapter): - def __init__(self, name='unknown', version='unknown'): - self._logger = None - self.extra = {} - self.name = name - self.version = version - - @property - def logger(self): - if not self._logger: - self._logger = getLogger(self.name, self.version) - if six.PY3: - # In Python 3, the code fails because the 'manager' attribute - # cannot be found when using a LoggerAdapter as the - # underlying logger. Work around this issue. - self._logger.manager = self._logger.logger.manager - return self._logger - - -class ContextAdapter(BaseLoggerAdapter): - warn = logging.LoggerAdapter.warning - - def __init__(self, logger, project_name, version_string): - self.logger = logger - self.project = project_name - self.version = version_string - self._deprecated_messages_sent = dict() - - @property - def handlers(self): - return self.logger.handlers - - def deprecated(self, msg, *args, **kwargs): - """Call this method when a deprecated feature is used. - - If the system is configured for fatal deprecations then the message - is logged at the 'critical' level and :class:`DeprecatedConfig` will - be raised. - - Otherwise, the message will be logged (once) at the 'warn' level. - - :raises: :class:`DeprecatedConfig` if the system is configured for - fatal deprecations. - - """ - stdmsg = _("Deprecated: %s") % msg - if CONF.fatal_deprecations: - self.critical(stdmsg, *args, **kwargs) - raise DeprecatedConfig(msg=stdmsg) - - # Using a list because a tuple with dict can't be stored in a set. - sent_args = self._deprecated_messages_sent.setdefault(msg, list()) - - if args in sent_args: - # Already logged this message, so don't log it again. - return - - sent_args.append(args) - self.warn(stdmsg, *args, **kwargs) - - def process(self, msg, kwargs): - # NOTE(jecarey): If msg is not unicode, coerce it into unicode - # before it can get to the python logging and - # possibly cause string encoding trouble - if not isinstance(msg, six.text_type): - msg = six.text_type(msg) - - if 'extra' not in kwargs: - kwargs['extra'] = {} - extra = kwargs['extra'] - - context = kwargs.pop('context', None) - if not context: - context = getattr(local.store, 'context', None) - if context: - extra.update(_dictify_context(context)) - - instance = kwargs.pop('instance', None) - instance_uuid = (extra.get('instance_uuid') or - kwargs.pop('instance_uuid', None)) - instance_extra = '' - if instance: - instance_extra = CONF.instance_format % instance - elif instance_uuid: - instance_extra = (CONF.instance_uuid_format - % {'uuid': instance_uuid}) - extra['instance'] = instance_extra - - extra.setdefault('user_identity', kwargs.pop('user_identity', None)) - - extra['project'] = self.project - extra['version'] = self.version - extra['extra'] = extra.copy() - return msg, kwargs - - -class JSONFormatter(logging.Formatter): - def __init__(self, fmt=None, datefmt=None): - # NOTE(jkoelker) we ignore the fmt argument, but its still there - # since logging.config.fileConfig passes it. - self.datefmt = datefmt - - def formatException(self, ei, strip_newlines=True): - lines = traceback.format_exception(*ei) - if strip_newlines: - lines = [moves.filter( - lambda x: x, - line.rstrip().splitlines()) for line in lines] - lines = list(itertools.chain(*lines)) - return lines - - def format(self, record): - message = {'message': record.getMessage(), - 'asctime': self.formatTime(record, self.datefmt), - 'name': record.name, - 'msg': record.msg, - 'args': record.args, - 'levelname': record.levelname, - 'levelno': record.levelno, - 'pathname': record.pathname, - 'filename': record.filename, - 'module': record.module, - 'lineno': record.lineno, - 'funcname': record.funcName, - 'created': record.created, - 'msecs': record.msecs, - 'relative_created': record.relativeCreated, - 'thread': record.thread, - 'thread_name': record.threadName, - 'process_name': record.processName, - 'process': record.process, - 'traceback': None} - - if hasattr(record, 'extra'): - message['extra'] = record.extra - - if record.exc_info: - message['traceback'] = self.formatException(record.exc_info) - - return jsonutils.dumps(message) - - -def _create_logging_excepthook(product_name): - def logging_excepthook(exc_type, value, tb): - extra = {'exc_info': (exc_type, value, tb)} - getLogger(product_name).critical( - "".join(traceback.format_exception_only(exc_type, value)), - **extra) - return logging_excepthook - - -class LogConfigError(Exception): - - message = _('Error loading logging config %(log_config)s: %(err_msg)s') - - def __init__(self, log_config, err_msg): - self.log_config = log_config - self.err_msg = err_msg - - def __str__(self): - return self.message % dict(log_config=self.log_config, - err_msg=self.err_msg) - - -def _load_log_config(log_config_append): - try: - logging.config.fileConfig(log_config_append, - disable_existing_loggers=False) - except (moves.configparser.Error, KeyError) as exc: - raise LogConfigError(log_config_append, six.text_type(exc)) - - -def setup(product_name, version='unknown'): - """Setup logging.""" - if CONF.log_config_append: - _load_log_config(CONF.log_config_append) - else: - _setup_logging_from_conf(product_name, version) - sys.excepthook = _create_logging_excepthook(product_name) - - -def set_defaults(logging_context_format_string=None, - default_log_levels=None): - # Just in case the caller is not setting the - # default_log_level. This is insurance because - # we introduced the default_log_level parameter - # later in a backwards in-compatible change - if default_log_levels is not None: - cfg.set_defaults( - log_opts, - default_log_levels=default_log_levels) - if logging_context_format_string is not None: - cfg.set_defaults( - log_opts, - logging_context_format_string=logging_context_format_string) - - -def _find_facility_from_conf(): - facility_names = logging.handlers.SysLogHandler.facility_names - facility = getattr(logging.handlers.SysLogHandler, - CONF.syslog_log_facility, - None) - - if facility is None and CONF.syslog_log_facility in facility_names: - facility = facility_names.get(CONF.syslog_log_facility) - - if facility is None: - valid_facilities = facility_names.keys() - consts = ['LOG_AUTH', 'LOG_AUTHPRIV', 'LOG_CRON', 'LOG_DAEMON', - 'LOG_FTP', 'LOG_KERN', 'LOG_LPR', 'LOG_MAIL', 'LOG_NEWS', - 'LOG_AUTH', 'LOG_SYSLOG', 'LOG_USER', 'LOG_UUCP', - 'LOG_LOCAL0', 'LOG_LOCAL1', 'LOG_LOCAL2', 'LOG_LOCAL3', - 'LOG_LOCAL4', 'LOG_LOCAL5', 'LOG_LOCAL6', 'LOG_LOCAL7'] - valid_facilities.extend(consts) - raise TypeError(_('syslog facility must be one of: %s') % - ', '.join("'%s'" % fac - for fac in valid_facilities)) - - return facility - - -class RFCSysLogHandler(logging.handlers.SysLogHandler): - def __init__(self, *args, **kwargs): - self.binary_name = _get_binary_name() - # Do not use super() unless type(logging.handlers.SysLogHandler) - # is 'type' (Python 2.7). - # Use old style calls, if the type is 'classobj' (Python 2.6) - logging.handlers.SysLogHandler.__init__(self, *args, **kwargs) - - def format(self, record): - # Do not use super() unless type(logging.handlers.SysLogHandler) - # is 'type' (Python 2.7). - # Use old style calls, if the type is 'classobj' (Python 2.6) - msg = logging.handlers.SysLogHandler.format(self, record) - msg = self.binary_name + ' ' + msg - return msg - - -def _setup_logging_from_conf(project, version): - log_root = getLogger(None).logger - for handler in log_root.handlers: - log_root.removeHandler(handler) - - logpath = _get_log_file_path() - if logpath: - filelog = logging.handlers.WatchedFileHandler(logpath) - log_root.addHandler(filelog) - - if CONF.use_stderr: - streamlog = ColorHandler() - log_root.addHandler(streamlog) - - elif not logpath: - # pass sys.stdout as a positional argument - # python2.6 calls the argument strm, in 2.7 it's stream - streamlog = logging.StreamHandler(sys.stdout) - log_root.addHandler(streamlog) - - if CONF.publish_errors: - handler = importutils.import_object( - "oslo.messaging.notify.log_handler.PublishErrorsHandler", - logging.ERROR) - log_root.addHandler(handler) - - datefmt = CONF.log_date_format - for handler in log_root.handlers: - # NOTE(alaski): CONF.log_format overrides everything currently. This - # should be deprecated in favor of context aware formatting. - if CONF.log_format: - handler.setFormatter(logging.Formatter(fmt=CONF.log_format, - datefmt=datefmt)) - log_root.info('Deprecated: log_format is now deprecated and will ' - 'be removed in the next release') - else: - handler.setFormatter(ContextFormatter(project=project, - version=version, - datefmt=datefmt)) - - if CONF.debug: - log_root.setLevel(logging.DEBUG) - elif CONF.verbose: - log_root.setLevel(logging.INFO) - else: - log_root.setLevel(logging.WARNING) - - for pair in CONF.default_log_levels: - mod, _sep, level_name = pair.partition('=') - logger = logging.getLogger(mod) - # NOTE(AAzza) in python2.6 Logger.setLevel doesn't convert string name - # to integer code. - if sys.version_info < (2, 7): - level = logging.getLevelName(level_name) - logger.setLevel(level) - else: - logger.setLevel(level_name) - - if CONF.use_syslog: - try: - facility = _find_facility_from_conf() - # TODO(bogdando) use the format provided by RFCSysLogHandler - # after existing syslog format deprecation in J - if CONF.use_syslog_rfc_format: - syslog = RFCSysLogHandler(address='/dev/log', - facility=facility) - else: - syslog = logging.handlers.SysLogHandler(address='/dev/log', - facility=facility) - log_root.addHandler(syslog) - except socket.error: - log_root.error('Unable to add syslog handler. Verify that syslog ' - 'is running.') - - -_loggers = {} - - -def getLogger(name='unknown', version='unknown'): - if name not in _loggers: - _loggers[name] = ContextAdapter(logging.getLogger(name), - name, - version) - return _loggers[name] - - -def getLazyLogger(name='unknown', version='unknown'): - """Returns lazy logger. - - Creates a pass-through logger that does not create the real logger - until it is really needed and delegates all calls to the real logger - once it is created. - """ - return LazyAdapter(name, version) - - -class WritableLogger(object): - """A thin wrapper that responds to `write` and logs.""" - - def __init__(self, logger, level=logging.INFO): - self.logger = logger - self.level = level - - def write(self, msg): - self.logger.log(self.level, msg.rstrip()) - - -class ContextFormatter(logging.Formatter): - """A context.RequestContext aware formatter configured through flags. - - The flags used to set format strings are: logging_context_format_string - and logging_default_format_string. You can also specify - logging_debug_format_suffix to append extra formatting if the log level is - debug. - - For information about what variables are available for the formatter see: - http://docs.python.org/library/logging.html#formatter - - If available, uses the context value stored in TLS - local.store.context - - """ - - def __init__(self, *args, **kwargs): - """Initialize ContextFormatter instance - - Takes additional keyword arguments which can be used in the message - format string. - - :keyword project: project name - :type project: string - :keyword version: project version - :type version: string - - """ - - self.project = kwargs.pop('project', 'unknown') - self.version = kwargs.pop('version', 'unknown') - - logging.Formatter.__init__(self, *args, **kwargs) - - def format(self, record): - """Uses contextstring if request_id is set, otherwise default.""" - - # NOTE(jecarey): If msg is not unicode, coerce it into unicode - # before it can get to the python logging and - # possibly cause string encoding trouble - if not isinstance(record.msg, six.text_type): - record.msg = six.text_type(record.msg) - - # store project info - record.project = self.project - record.version = self.version - - # store request info - context = getattr(local.store, 'context', None) - if context: - d = _dictify_context(context) - for k, v in d.items(): - setattr(record, k, v) - - # NOTE(sdague): default the fancier formatting params - # to an empty string so we don't throw an exception if - # they get used - for key in ('instance', 'color', 'user_identity'): - if key not in record.__dict__: - record.__dict__[key] = '' - - if record.__dict__.get('request_id'): - fmt = CONF.logging_context_format_string - else: - fmt = CONF.logging_default_format_string - - if (record.levelno == logging.DEBUG and - CONF.logging_debug_format_suffix): - fmt += " " + CONF.logging_debug_format_suffix - - if sys.version_info < (3, 2): - self._fmt = fmt - else: - self._style = logging.PercentStyle(fmt) - self._fmt = self._style._fmt - # Cache this on the record, Logger will respect our formatted copy - if record.exc_info: - record.exc_text = self.formatException(record.exc_info, record) - return logging.Formatter.format(self, record) - - def formatException(self, exc_info, record=None): - """Format exception output with CONF.logging_exception_prefix.""" - if not record: - return logging.Formatter.formatException(self, exc_info) - - stringbuffer = moves.StringIO() - traceback.print_exception(exc_info[0], exc_info[1], exc_info[2], - None, stringbuffer) - lines = stringbuffer.getvalue().split('\n') - stringbuffer.close() - - if CONF.logging_exception_prefix.find('%(asctime)') != -1: - record.asctime = self.formatTime(record, self.datefmt) - - formatted_lines = [] - for line in lines: - pl = CONF.logging_exception_prefix % record.__dict__ - fl = '%s%s' % (pl, line) - formatted_lines.append(fl) - return '\n'.join(formatted_lines) - - -class ColorHandler(logging.StreamHandler): - LEVEL_COLORS = { - logging.DEBUG: '\033[00;32m', # GREEN - logging.INFO: '\033[00;36m', # CYAN - logging.AUDIT: '\033[01;36m', # BOLD CYAN - logging.WARN: '\033[01;33m', # BOLD YELLOW - logging.ERROR: '\033[01;31m', # BOLD RED - logging.CRITICAL: '\033[01;31m', # BOLD RED - } - - def format(self, record): - record.color = self.LEVEL_COLORS[record.levelno] - return logging.StreamHandler.format(self, record) - - -class DeprecatedConfig(Exception): - message = _("Fatal call to deprecated config: %(msg)s") - - def __init__(self, msg): - super(Exception, self).__init__(self.message % dict(msg=msg)) diff --git a/designate/openstack/common/loopingcall.py b/designate/openstack/common/loopingcall.py index 10ad11356..ea94b1200 100644 --- a/designate/openstack/common/loopingcall.py +++ b/designate/openstack/common/loopingcall.py @@ -20,9 +20,9 @@ import time from eventlet import event from eventlet import greenthread +from oslo_log import log as logging from designate.openstack.common._i18n import _LE, _LW -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/openstack/common/policy.py b/designate/openstack/common/policy.py index 4069fc945..0c7bf293e 100644 --- a/designate/openstack/common/policy.py +++ b/designate/openstack/common/policy.py @@ -95,6 +95,7 @@ import os import re from oslo.config import cfg +from oslo_log import log as logging from oslo.serialization import jsonutils import six import six.moves.urllib.parse as urlparse @@ -102,7 +103,6 @@ import six.moves.urllib.request as urlrequest from designate.openstack.common import fileutils from designate.openstack.common._i18n import _, _LE, _LI -from designate.openstack.common import log as logging policy_opts = [ diff --git a/designate/openstack/common/service.py b/designate/openstack/common/service.py index ab3cc75a2..87ee15eb8 100644 --- a/designate/openstack/common/service.py +++ b/designate/openstack/common/service.py @@ -36,10 +36,11 @@ except ImportError: import eventlet from eventlet import event from oslo.config import cfg +from oslo_log import log as logging + from designate.openstack.common import eventlet_backdoor from designate.openstack.common._i18n import _LE, _LI, _LW -from designate.openstack.common import log as logging from designate.openstack.common import systemd from designate.openstack.common import threadgroup diff --git a/designate/openstack/common/systemd.py b/designate/openstack/common/systemd.py index ab6a81965..52bbeda64 100644 --- a/designate/openstack/common/systemd.py +++ b/designate/openstack/common/systemd.py @@ -20,7 +20,7 @@ import os import socket import sys -from designate.openstack.common import log as logging +from oslo_log import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/openstack/common/threadgroup.py b/designate/openstack/common/threadgroup.py index 4b67acd68..1b2dd911a 100644 --- a/designate/openstack/common/threadgroup.py +++ b/designate/openstack/common/threadgroup.py @@ -15,8 +15,8 @@ import threading import eventlet from eventlet import greenpool +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate.openstack.common import loopingcall diff --git a/designate/openstack/common/versionutils.py b/designate/openstack/common/versionutils.py index 824819020..a5124b84f 100644 --- a/designate/openstack/common/versionutils.py +++ b/designate/openstack/common/versionutils.py @@ -20,11 +20,11 @@ Helpers for comparing version strings. import functools import inspect +from oslo_log import log as logging import pkg_resources import six from designate.openstack.common._i18n import _ -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/openstack/deprecated/wsgi.py b/designate/openstack/deprecated/wsgi.py index 2d2c4fd84..071c23a16 100644 --- a/designate/openstack/deprecated/wsgi.py +++ b/designate/openstack/deprecated/wsgi.py @@ -28,6 +28,8 @@ import time import eventlet.wsgi from oslo.config import cfg +from oslo_log import log as logging +from oslo_log import loggers from oslo.serialization import jsonutils import routes import routes.middleware @@ -37,7 +39,6 @@ from xml.dom import minidom from xml.parsers import expat from designate.i18n import _ -from designate.openstack.common import log as logging from designate.openstack.common import service from designate.openstack.common import sslutils from designate.openstack.deprecated import exception @@ -158,7 +159,7 @@ class Service(service.Service): eventlet.wsgi.server(socket, application, custom_pool=self.tg.pool, - log=logging.WritableLogger(logger)) + log=loggers.WritableLogger(logger)) class Middleware(object): diff --git a/designate/plugin.py b/designate/plugin.py index f7f157aa7..b4ec786a4 100644 --- a/designate/plugin.py +++ b/designate/plugin.py @@ -20,8 +20,7 @@ from stevedore import driver from stevedore import enabled from stevedore import extension from oslo.config import cfg - -from designate.openstack.common import log as logging +from oslo_log import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/policy.py b/designate/policy.py index 18f9b9513..a92d04ff6 100644 --- a/designate/policy.py +++ b/designate/policy.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. from oslo.config import cfg +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate.openstack.common import policy from designate.i18n import _ from designate.i18n import _LI diff --git a/designate/pool_manager/cache/__init__.py b/designate/pool_manager/cache/__init__.py index 6758b8126..81185f7c0 100644 --- a/designate/pool_manager/cache/__init__.py +++ b/designate/pool_manager/cache/__init__.py @@ -13,7 +13,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from designate.openstack.common import log as logging +from oslo_log import log as logging + from designate.pool_manager.cache.base import PoolManagerCache LOG = logging.getLogger(__name__) diff --git a/designate/pool_manager/cache/impl_sqlalchemy/__init__.py b/designate/pool_manager/cache/impl_sqlalchemy/__init__.py index f2411635f..9081233f9 100644 --- a/designate/pool_manager/cache/impl_sqlalchemy/__init__.py +++ b/designate/pool_manager/cache/impl_sqlalchemy/__init__.py @@ -15,8 +15,8 @@ # under the License. from oslo.config import cfg from oslo_db import options +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import exceptions from designate import objects from designate.pool_manager.cache import base as cache_base diff --git a/designate/pool_manager/rpcapi.py b/designate/pool_manager/rpcapi.py index a058c7670..e72b34ccb 100644 --- a/designate/pool_manager/rpcapi.py +++ b/designate/pool_manager/rpcapi.py @@ -14,9 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. from oslo.config import cfg +from oslo_log import log as logging from oslo import messaging -from designate.openstack.common import log as logging from designate.i18n import _LI from designate import rpc diff --git a/designate/pool_manager/service.py b/designate/pool_manager/service.py index 7284b6da4..c904a9603 100644 --- a/designate/pool_manager/service.py +++ b/designate/pool_manager/service.py @@ -18,6 +18,7 @@ from decimal import Decimal from oslo.config import cfg from oslo import messaging +from oslo_log import log as logging from designate import backend from designate import exceptions @@ -29,7 +30,6 @@ from designate.context import DesignateContext from designate.i18n import _LE from designate.i18n import _LI from designate.i18n import _LW -from designate.openstack.common import log as logging from designate.pool_manager import cache diff --git a/designate/quota/__init__.py b/designate/quota/__init__.py index e8a5b651f..0fe1a1f4d 100644 --- a/designate/quota/__init__.py +++ b/designate/quota/__init__.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. from oslo.config import cfg +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate.quota.base import Quota diff --git a/designate/quota/impl_noop.py b/designate/quota/impl_noop.py index f537274bb..a44a7b573 100644 --- a/designate/quota/impl_noop.py +++ b/designate/quota/impl_noop.py @@ -13,7 +13,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from designate.openstack.common import log as logging +from oslo_log import log as logging + from designate.quota.base import Quota LOG = logging.getLogger(__name__) diff --git a/designate/quota/impl_storage.py b/designate/quota/impl_storage.py index 6e8e18341..45953aebb 100644 --- a/designate/quota/impl_storage.py +++ b/designate/quota/impl_storage.py @@ -14,11 +14,11 @@ # License for the specific language governing permissions and limitations # under the License. from oslo.config import cfg +from oslo_log import log as logging from designate import exceptions from designate import storage from designate import objects -from designate.openstack.common import log as logging from designate.quota.base import Quota diff --git a/designate/schema/__init__.py b/designate/schema/__init__.py index 53016dcd2..26cff53f9 100644 --- a/designate/schema/__init__.py +++ b/designate/schema/__init__.py @@ -13,7 +13,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from designate.openstack.common import log as logging +from oslo_log import log as logging + from designate import exceptions from designate import utils from designate.schema import validators diff --git a/designate/schema/format.py b/designate/schema/format.py index b20172076..40f931f4a 100644 --- a/designate/schema/format.py +++ b/designate/schema/format.py @@ -18,8 +18,7 @@ import re import jsonschema from jsonschema import compat import netaddr - -from designate.openstack.common import log as logging +from oslo_log import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/schema/resolvers.py b/designate/schema/resolvers.py index 73d4a4650..f58745a77 100644 --- a/designate/schema/resolvers.py +++ b/designate/schema/resolvers.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. import jsonschema +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import utils diff --git a/designate/schema/validators.py b/designate/schema/validators.py index 3d04a5c86..8955da315 100644 --- a/designate/schema/validators.py +++ b/designate/schema/validators.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. from jsonschema import validators +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate.schema import _validators diff --git a/designate/service.py b/designate/service.py index 0b54e5b0c..3b293af02 100644 --- a/designate/service.py +++ b/designate/service.py @@ -19,9 +19,9 @@ import inspect from oslo import messaging from oslo.config import cfg +from oslo_log import log as logging from designate.openstack.common import service -from designate.openstack.common import log as logging from designate.openstack.deprecated import wsgi from designate.i18n import _ from designate import rpc diff --git a/designate/sink/service.py b/designate/sink/service.py index 47334281b..42b168198 100644 --- a/designate/sink/service.py +++ b/designate/sink/service.py @@ -15,9 +15,9 @@ # License for the specific language governing permissions and limitations # under the License. from oslo.config import cfg +from oslo_log import log as logging from oslo import messaging -from designate.openstack.common import log as logging from designate.i18n import _LW from designate import notification_handler from designate import rpc diff --git a/designate/sqlalchemy/base.py b/designate/sqlalchemy/base.py index d30a16570..74629045f 100644 --- a/designate/sqlalchemy/base.py +++ b/designate/sqlalchemy/base.py @@ -19,11 +19,11 @@ import threading import six from oslo_db.sqlalchemy import utils as oslodb_utils from oslo_db import exception as oslo_db_exception +from oslo_log import log as logging from oslo_utils import timeutils from sqlalchemy import exc as sqlalchemy_exc from sqlalchemy import select, or_ -from designate.openstack.common import log as logging from designate import exceptions from designate.sqlalchemy import session from designate.sqlalchemy import utils diff --git a/designate/sqlalchemy/session.py b/designate/sqlalchemy/session.py index a8a122193..e2f8aeaf9 100644 --- a/designate/sqlalchemy/session.py +++ b/designate/sqlalchemy/session.py @@ -18,8 +18,7 @@ from oslo.config import cfg from oslo_db.sqlalchemy import session - -from designate.openstack.common import log as logging +from oslo_log import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/storage/__init__.py b/designate/storage/__init__.py index f37cf3625..827459c77 100644 --- a/designate/storage/__init__.py +++ b/designate/storage/__init__.py @@ -13,9 +13,10 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from designate.openstack.common import log as logging from designate.storage.base import Storage +from oslo_log import log as logging + LOG = logging.getLogger(__name__) diff --git a/designate/storage/impl_sqlalchemy/__init__.py b/designate/storage/impl_sqlalchemy/__init__.py index ed184a002..bd9a3bb62 100644 --- a/designate/storage/impl_sqlalchemy/__init__.py +++ b/designate/storage/impl_sqlalchemy/__init__.py @@ -17,11 +17,11 @@ import time import hashlib from oslo.config import cfg +from oslo_log import log as logging from oslo_db import options from sqlalchemy import select, distinct, func from sqlalchemy.sql.expression import or_ -from designate.openstack.common import log as logging from designate import exceptions from designate import objects from designate.sqlalchemy import base as sqlalchemy_base diff --git a/designate/storage/impl_sqlalchemy/migrate_repo/utils.py b/designate/storage/impl_sqlalchemy/migrate_repo/utils.py index 9d4a6cb1f..3c4c07cb9 100644 --- a/designate/storage/impl_sqlalchemy/migrate_repo/utils.py +++ b/designate/storage/impl_sqlalchemy/migrate_repo/utils.py @@ -20,10 +20,9 @@ """ Various conveniences used for migration scripts """ +from oslo_log import log as logging from sqlalchemy.schema import Table as SqlaTable -from designate.openstack.common import log as logging - LOG = logging.getLogger(__name__) diff --git a/designate/tests/__init__.py b/designate/tests/__init__.py index 10dee76f4..e9ff5d0ce 100644 --- a/designate/tests/__init__.py +++ b/designate/tests/__init__.py @@ -22,6 +22,7 @@ import tempfile import fixtures from oslotest import base +from oslo_log import log as logging from oslo.config import cfg from oslo.config import fixture as cfg_fixture from oslo.messaging import conffixture as messaging_fixture @@ -29,7 +30,6 @@ from oslo.messaging.notify import _impl_test as test_notifier from oslo_utils import importutils from testtools import testcase -from designate.openstack.common import log as logging from designate import policy from designate import utils from designate.context import DesignateContext diff --git a/designate/tests/test_api/test_v1/__init__.py b/designate/tests/test_api/test_v1/__init__.py index bf7ae9587..f2f1b8d5e 100644 --- a/designate/tests/test_api/test_v1/__init__.py +++ b/designate/tests/test_api/test_v1/__init__.py @@ -13,9 +13,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging from oslo.serialization import jsonutils as json -from designate.openstack.common import log as logging from designate.api import v1 as api_v1 from designate.api import middleware from designate.tests.test_api import ApiTestCase diff --git a/designate/tests/test_api/test_v1/test_domains.py b/designate/tests/test_api/test_v1/test_domains.py index 46ab9559c..96a93d8ca 100644 --- a/designate/tests/test_api/test_v1/test_domains.py +++ b/designate/tests/test_api/test_v1/test_domains.py @@ -18,8 +18,8 @@ import datetime from mock import patch from oslo import messaging +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import exceptions from designate.central import service as central_service from designate.tests.test_api.test_v1 import ApiV1Test diff --git a/designate/tests/test_api/test_v1/test_records.py b/designate/tests/test_api/test_v1/test_records.py index d9691a44e..9120ce224 100644 --- a/designate/tests/test_api/test_v1/test_records.py +++ b/designate/tests/test_api/test_v1/test_records.py @@ -16,8 +16,8 @@ # under the License. from mock import patch from oslo import messaging +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate.central import service as central_service from designate.tests.test_api.test_v1 import ApiV1Test diff --git a/designate/tests/test_api/test_v1/test_servers.py b/designate/tests/test_api/test_v1/test_servers.py index 6fe3cfd04..81baaa960 100644 --- a/designate/tests/test_api/test_v1/test_servers.py +++ b/designate/tests/test_api/test_v1/test_servers.py @@ -15,8 +15,8 @@ # under the License. from mock import patch from oslo import messaging +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import exceptions from designate import objects from designate.central import service as central_service diff --git a/designate/tests/test_api/test_v2/__init__.py b/designate/tests/test_api/test_v2/__init__.py index 050d0d245..a39f7b299 100644 --- a/designate/tests/test_api/test_v2/__init__.py +++ b/designate/tests/test_api/test_v2/__init__.py @@ -15,9 +15,9 @@ # under the License. import itertools +from oslo_log import log as logging from webtest import TestApp -from designate.openstack.common import log as logging from designate.api import v2 as api_v2 from designate.api import middleware from designate.tests.test_api import ApiTestCase diff --git a/designate/tests/test_api/test_v2/test_nameservers.py b/designate/tests/test_api/test_v2/test_nameservers.py index 81bac93e2..8f0a53cac 100644 --- a/designate/tests/test_api/test_v2/test_nameservers.py +++ b/designate/tests/test_api/test_v2/test_nameservers.py @@ -15,8 +15,8 @@ # under the License. from mock import patch from oslo import messaging +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate.central import service as central_service from designate.tests.test_api.test_v2 import ApiV2TestCase diff --git a/designate/tests/test_api/test_v2/test_pools.py b/designate/tests/test_api/test_v2/test_pools.py index 7a58d584d..417f5fc10 100644 --- a/designate/tests/test_api/test_v2/test_pools.py +++ b/designate/tests/test_api/test_v2/test_pools.py @@ -13,8 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. from oslo.config import cfg +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate.tests.test_api.test_v2 import ApiV2TestCase LOG = logging.getLogger(__name__) diff --git a/designate/tests/test_api/test_v2/test_recordsets.py b/designate/tests/test_api/test_v2/test_recordsets.py index c79c3cc79..806806fd3 100644 --- a/designate/tests/test_api/test_v2/test_recordsets.py +++ b/designate/tests/test_api/test_v2/test_recordsets.py @@ -15,8 +15,8 @@ # under the License. from mock import patch from oslo import messaging +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import exceptions from designate.central import service as central_service from designate.tests.test_api.test_v2 import ApiV2TestCase diff --git a/designate/tests/test_api/test_v2/test_zones.py b/designate/tests/test_api/test_v2/test_zones.py index fa8c25f0b..9d166b12f 100644 --- a/designate/tests/test_api/test_v2/test_zones.py +++ b/designate/tests/test_api/test_v2/test_zones.py @@ -16,9 +16,9 @@ from dns import zone as dnszone from mock import patch from oslo import messaging +from oslo_log import log as logging from designate import exceptions -from designate.openstack.common import log as logging from designate.central import service as central_service from designate.tests.test_api.test_v2 import ApiV2TestCase diff --git a/designate/tests/test_central/_test_service_ipa.py b/designate/tests/test_central/_test_service_ipa.py index 5e019eaca..cfc39ff7a 100644 --- a/designate/tests/test_central/_test_service_ipa.py +++ b/designate/tests/test_central/_test_service_ipa.py @@ -16,9 +16,9 @@ # under the License. import unittest +from oslo_log import log as logging import testtools -from designate.openstack.common import log as logging import designate.tests.test_central.test_service from designate import utils from designate import exceptions diff --git a/designate/tests/test_central/test_service.py b/designate/tests/test_central/test_service.py index ecb96121a..c0cc168a8 100644 --- a/designate/tests/test_central/test_service.py +++ b/designate/tests/test_central/test_service.py @@ -18,10 +18,10 @@ import copy import random from mock import patch +from oslo_log import log as logging import testtools from testtools.matchers import GreaterThan -from designate.openstack.common import log as logging from designate import exceptions from designate import objects from designate.tests.test_central import CentralTestCase diff --git a/designate/tests/test_context.py b/designate/tests/test_context.py index 957480d9f..e0f269978 100644 --- a/designate/tests/test_context.py +++ b/designate/tests/test_context.py @@ -14,11 +14,11 @@ # License for the specific language governing permissions and limitations # under the License. import testtools +from oslo_log import log as logging from designate.tests import TestCase from designate import context from designate import exceptions -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/tests/test_notification_handler/test_neutron.py b/designate/tests/test_notification_handler/test_neutron.py index 88cc6a30c..91ab8f195 100644 --- a/designate/tests/test_notification_handler/test_neutron.py +++ b/designate/tests/test_notification_handler/test_neutron.py @@ -13,7 +13,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from designate.openstack.common import log as logging +from oslo_log import log as logging + from designate.tests import TestCase from designate.notification_handler.neutron import NeutronFloatingHandler from designate.tests.test_notification_handler import \ diff --git a/designate/tests/test_notification_handler/test_nova.py b/designate/tests/test_notification_handler/test_nova.py index 40b77a0f2..32b6f238f 100644 --- a/designate/tests/test_notification_handler/test_nova.py +++ b/designate/tests/test_notification_handler/test_nova.py @@ -13,7 +13,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from designate.openstack.common import log as logging +from oslo_log import log as logging + from designate.tests import TestCase from designate.notification_handler.nova import NovaFixedHandler from designate.tests.test_notification_handler import \ diff --git a/designate/tests/test_objects/test_base.py b/designate/tests/test_objects/test_base.py index c6038172d..881eebeca 100644 --- a/designate/tests/test_objects/test_base.py +++ b/designate/tests/test_objects/test_base.py @@ -17,8 +17,8 @@ import copy from operator import attrgetter import testtools +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import tests from designate import objects from designate import exceptions diff --git a/designate/tests/test_quota/test_quota.py b/designate/tests/test_quota/test_quota.py index af92df6e6..e6e895fa7 100644 --- a/designate/tests/test_quota/test_quota.py +++ b/designate/tests/test_quota/test_quota.py @@ -16,8 +16,8 @@ from testscenarios import load_tests_apply_scenarios as load_tests # noqa import testtools from oslo.config import cfg +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import quota from designate import tests from designate import exceptions diff --git a/designate/tests/test_quota/test_storage.py b/designate/tests/test_quota/test_storage.py index af40a8b13..3d46847c9 100644 --- a/designate/tests/test_quota/test_storage.py +++ b/designate/tests/test_quota/test_storage.py @@ -13,9 +13,10 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from designate import quota from designate import tests -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/designate/tests/test_resources/test_schemas/test_v2.py b/designate/tests/test_resources/test_schemas/test_v2.py index f405bc6bc..24e0e56c9 100644 --- a/designate/tests/test_resources/test_schemas/test_v2.py +++ b/designate/tests/test_resources/test_schemas/test_v2.py @@ -13,7 +13,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from designate.openstack.common import log as logging +from oslo_log import log as logging + from designate import schema from designate.tests import TestCase diff --git a/designate/tests/test_resources/test_templates/test_bind9.py b/designate/tests/test_resources/test_templates/test_bind9.py index 2b35ee02e..a64df6e1c 100644 --- a/designate/tests/test_resources/test_templates/test_bind9.py +++ b/designate/tests/test_resources/test_templates/test_bind9.py @@ -13,7 +13,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from designate.openstack.common import log as logging +from oslo_log import log as logging + from designate.tests import TestCase from designate import utils diff --git a/designate/tests/test_schema/test_format.py b/designate/tests/test_schema/test_format.py index 847d21a03..036afb68b 100644 --- a/designate/tests/test_schema/test_format.py +++ b/designate/tests/test_schema/test_format.py @@ -13,10 +13,12 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log as logging + from designate.tests import TestCase -from designate.openstack.common import log as logging from designate.schema import format + LOG = logging.getLogger(__name__) diff --git a/designate/tests/test_storage/__init__.py b/designate/tests/test_storage/__init__.py index 84d28a6ac..bfb6dc040 100644 --- a/designate/tests/test_storage/__init__.py +++ b/designate/tests/test_storage/__init__.py @@ -18,8 +18,8 @@ import math import testtools from oslo.config import cfg +from oslo_log import log as logging -from designate.openstack.common import log as logging from designate import exceptions from designate import objects from designate.storage.base import Storage as StorageBase diff --git a/designate/tests/test_storage/test_sqlalchemy.py b/designate/tests/test_storage/test_sqlalchemy.py index 2a1ef194c..3b8622dab 100644 --- a/designate/tests/test_storage/test_sqlalchemy.py +++ b/designate/tests/test_storage/test_sqlalchemy.py @@ -13,7 +13,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from designate.openstack.common import log as logging +from oslo_log import log as logging + from designate import storage from designate.tests import TestCase from designate.tests.test_storage import StorageTestCase diff --git a/designate/utils.py b/designate/utils.py index b4224bcdc..f562064cf 100644 --- a/designate/utils.py +++ b/designate/utils.py @@ -24,10 +24,10 @@ import pkg_resources from jinja2 import Template from oslo.config import cfg from oslo_concurrency import processutils +from oslo_log import log as logging from oslo_utils import timeutils from designate import exceptions -from designate.openstack.common import log as logging LOG = logging.getLogger(__name__) @@ -86,8 +86,8 @@ def find_config(config_path): def read_config(prog, argv): + logging.register_options(cfg.CONF) config_files = find_config('%s.conf' % prog) - cfg.CONF(argv[1:], project='designate', prog=prog, default_config_files=config_files) diff --git a/openstack-common.conf b/openstack-common.conf index 75e7f35f7..4af92157c 100644 --- a/openstack-common.conf +++ b/openstack-common.conf @@ -6,7 +6,6 @@ script=tools/install_venv_common.py # The list of modules to copy from oslo-incubator.git module=fixture.config module=local -module=log module=policy module=service module=timeutils diff --git a/requirements.txt b/requirements.txt index 43b59131c..b919ece52 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,6 +15,7 @@ oslo.config>=1.6.0 # Apache-2.0 oslo.concurrency>=0.3.0,!=0.4.0 # Apache-2.0 oslo.messaging>=1.4.0,!=1.5.0 oslo.middleware>=0.3.0 # Apache-2.0 +oslo.log>=0.1.0 # Apache-2.0 oslo.rootwrap>=1.3.0 oslo.serialization>=1.2.0 # Apache-2.0 oslo.utils>=1.2.0 # Apache-2.0