Merge "Move to graduated oslo.log module"
This commit is contained in:
commit
bb59c33ffc
@ -7,3 +7,4 @@ namespace = oslo.messaging
|
||||
namespace = oslo.db
|
||||
namespace = oslo.db.concurrency
|
||||
namespace = keystoneclient.middleware.auth_token
|
||||
namespace = oslo.log
|
||||
|
@ -1,3 +1,4 @@
|
||||
[DEFAULT]
|
||||
output_file = etc/glance-cache.conf.sample
|
||||
namespace = glance.cache
|
||||
namespace = oslo.log
|
||||
|
@ -3,3 +3,4 @@ output_file = etc/glance-manage.conf.sample
|
||||
namespace = glance.manage
|
||||
namespace = oslo.db
|
||||
namespace = oslo.db.concurrency
|
||||
namespace = oslo.log
|
||||
|
@ -6,3 +6,4 @@ namespace = oslo.messaging
|
||||
namespace = oslo.db
|
||||
namespace = oslo.db.concurrency
|
||||
namespace = keystoneclient.middleware.auth_token
|
||||
namespace = oslo.log
|
||||
|
@ -4,3 +4,4 @@ namespace = glance.scrubber
|
||||
namespace = oslo.concurrency
|
||||
namespace = oslo.db
|
||||
namespace = oslo.db.concurrency
|
||||
namespace = oslo.log
|
||||
|
@ -17,13 +17,13 @@ import re
|
||||
|
||||
from oslo_concurrency import lockutils
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import units
|
||||
|
||||
from glance.common import exception
|
||||
from glance.common import wsgi
|
||||
from glance import i18n
|
||||
from glance.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
_ = i18n._
|
||||
|
@ -24,6 +24,7 @@ the local cached copy of the image file is returned.
|
||||
|
||||
import re
|
||||
|
||||
from oslo_log import log as logging
|
||||
import webob
|
||||
|
||||
from glance.api.common import size_checked_iter
|
||||
@ -36,7 +37,6 @@ import glance.db
|
||||
from glance import i18n
|
||||
from glance import image_cache
|
||||
from glance import notifier
|
||||
import glance.openstack.common.log as logging
|
||||
import glance.registry.client.v1.api as registry
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -17,12 +17,12 @@
|
||||
Image Cache Management API
|
||||
"""
|
||||
|
||||
from oslo_log import log as logging
|
||||
import routes
|
||||
|
||||
from glance.api import cached_images
|
||||
from glance.common import wsgi
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
_LI = i18n._LI
|
||||
|
@ -15,13 +15,13 @@
|
||||
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import webob.exc
|
||||
|
||||
from glance.api import policy
|
||||
from glance.common import wsgi
|
||||
import glance.context
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
_ = i18n._
|
||||
|
||||
|
@ -19,9 +19,10 @@ Use gzip compression if the client accepts it.
|
||||
|
||||
import re
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
from glance.common import wsgi
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
_LI = i18n._LI
|
||||
|
@ -20,11 +20,11 @@ return
|
||||
"""
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from glance.api import versions
|
||||
from glance.common import wsgi
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
@ -19,11 +19,11 @@
|
||||
import copy
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from glance.common import exception
|
||||
import glance.domain.proxy
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
from glance.openstack.common import policy
|
||||
|
||||
|
||||
|
@ -14,11 +14,11 @@
|
||||
# under the License.
|
||||
|
||||
import glance_store as store
|
||||
from oslo_log import log as logging
|
||||
import webob.exc
|
||||
|
||||
from glance.common import exception
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
import glance.registry.client.v1.api as registry
|
||||
|
||||
|
||||
|
@ -22,6 +22,7 @@ import copy
|
||||
import glance_store as store
|
||||
import glance_store.location
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import strutils
|
||||
from webob.exc import HTTPBadRequest
|
||||
@ -46,7 +47,6 @@ from glance.common import utils
|
||||
from glance.common import wsgi
|
||||
from glance import i18n
|
||||
from glance import notifier
|
||||
import glance.openstack.common.log as logging
|
||||
import glance.registry.client.v1.api as registry
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -719,7 +719,7 @@ class Controller(controller.BaseController):
|
||||
return (image_meta.get('size', 0) or
|
||||
store.get_size_from_backend(location, context=context))
|
||||
except (store.NotFound, store.BadStoreUri) as e:
|
||||
LOG.debug(e)
|
||||
LOG.debug(utils.exception_to_str(e))
|
||||
raise HTTPBadRequest(explanation=e.msg, content_type="text/plain")
|
||||
|
||||
def _handle_source(self, req, image_id, image_meta, image_data):
|
||||
|
@ -15,6 +15,7 @@
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import webob.exc
|
||||
|
||||
from glance.api import policy
|
||||
@ -23,7 +24,6 @@ from glance.common import exception
|
||||
from glance.common import utils
|
||||
from glance.common import wsgi
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
import glance.registry.client.v1.api as registry
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -14,6 +14,7 @@
|
||||
# under the License.
|
||||
import glance_store as store_api
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
import webob.exc
|
||||
|
||||
@ -22,7 +23,6 @@ from glance.common import store_utils
|
||||
from glance.common import utils
|
||||
import glance.db
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
import glance.registry.client.v1.api as registry
|
||||
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import glance_store
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
import webob.exc
|
||||
|
||||
@ -24,7 +25,6 @@ import glance.db
|
||||
import glance.gateway
|
||||
from glance import i18n
|
||||
import glance.notifier
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -17,6 +17,7 @@ import copy
|
||||
|
||||
import glance_store
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
import webob
|
||||
@ -29,7 +30,6 @@ import glance.db
|
||||
import glance.gateway
|
||||
from glance import i18n
|
||||
import glance.notifier
|
||||
import glance.openstack.common.log as logging
|
||||
import glance.schema
|
||||
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import glance_store
|
||||
from oslo_log import log as logging
|
||||
import webob.exc
|
||||
|
||||
from glance.api import policy
|
||||
@ -23,7 +24,6 @@ import glance.db
|
||||
import glance.gateway
|
||||
from glance import i18n
|
||||
import glance.notifier
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -18,6 +18,7 @@ import re
|
||||
import glance_store
|
||||
from oslo.serialization import jsonutils as json
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
import six.moves.urllib.parse as urlparse
|
||||
@ -32,7 +33,6 @@ import glance.db
|
||||
import glance.gateway
|
||||
from glance import i18n
|
||||
import glance.notifier
|
||||
import glance.openstack.common.log as logging
|
||||
import glance.schema
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
import six.moves.urllib.parse as urlparse
|
||||
import webob.exc
|
||||
@ -35,7 +36,6 @@ import glance.db
|
||||
import glance.gateway
|
||||
from glance import i18n
|
||||
import glance.notifier
|
||||
import glance.openstack.common.log as logging
|
||||
import glance.schema
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
import webob.exc
|
||||
from wsme.rest import json
|
||||
@ -30,7 +31,6 @@ from glance.common import wsme_utils
|
||||
import glance.db
|
||||
from glance import i18n
|
||||
import glance.notifier
|
||||
import glance.openstack.common.log as logging
|
||||
import glance.schema
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -14,6 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
import webob.exc
|
||||
from wsme.rest import json
|
||||
@ -30,7 +31,6 @@ import glance.db
|
||||
import glance.gateway
|
||||
from glance import i18n
|
||||
import glance.notifier
|
||||
import glance.openstack.common.log as logging
|
||||
import glance.schema
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -14,6 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
import webob.exc
|
||||
from wsme.rest import json
|
||||
@ -30,7 +31,6 @@ import glance.db
|
||||
import glance.gateway
|
||||
from glance import i18n
|
||||
import glance.notifier
|
||||
import glance.openstack.common.log as logging
|
||||
import glance.schema
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
import webob.exc
|
||||
from wsme.rest import json
|
||||
@ -29,7 +30,6 @@ from glance.common import wsme_utils
|
||||
import glance.db
|
||||
from glance import i18n
|
||||
import glance.notifier
|
||||
import glance.openstack.common.log as logging
|
||||
import glance.schema
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -19,6 +19,7 @@ import copy
|
||||
import glance_store
|
||||
import oslo.serialization.jsonutils as json
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
import six.moves.urllib.parse as urlparse
|
||||
@ -32,7 +33,6 @@ import glance.db
|
||||
import glance.gateway
|
||||
from glance import i18n
|
||||
import glance.notifier
|
||||
import glance.openstack.common.log as logging
|
||||
import glance.schema
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -13,8 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -16,6 +16,7 @@
|
||||
import contextlib
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
from stevedore import driver
|
||||
from taskflow import engines
|
||||
@ -26,7 +27,6 @@ from taskflow.utils import eventlet_utils
|
||||
import glance.async
|
||||
from glance.common.scripts import utils as script_utils
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
_ = i18n._
|
||||
_LE = i18n._LE
|
||||
|
@ -13,10 +13,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_log import log as logging
|
||||
from taskflow import task
|
||||
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -42,6 +42,7 @@ if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')):
|
||||
|
||||
import glance_store
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import osprofiler.notifier
|
||||
import osprofiler.web
|
||||
|
||||
@ -49,10 +50,10 @@ from glance.common import config
|
||||
from glance.common import exception
|
||||
from glance.common import wsgi
|
||||
from glance import notifier
|
||||
from glance.openstack.common import log
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_group("profiler", "glance.common.wsgi")
|
||||
logging.register_options(CONF)
|
||||
|
||||
KNOWN_EXCEPTIONS = (RuntimeError,
|
||||
exception.WorkerCreationFailure,
|
||||
@ -70,7 +71,7 @@ def main():
|
||||
try:
|
||||
config.parse_args()
|
||||
wsgi.set_eventlet_hub()
|
||||
log.setup('glance')
|
||||
logging.setup(CONF, 'glance')
|
||||
|
||||
if cfg.CONF.profiler.enabled:
|
||||
_notifier = osprofiler.notifier.create("Messaging",
|
||||
|
@ -32,6 +32,8 @@ period, we automatically sweep it up.
|
||||
import os
|
||||
import sys
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
# If ../glance/__init__.py exists, add ../ to Python search path, so that
|
||||
# it will override what happens to be installed in /usr/(local/)lib/python...
|
||||
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
||||
@ -42,13 +44,15 @@ if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')):
|
||||
|
||||
from glance.common import config
|
||||
from glance.image_cache import cleaner
|
||||
from glance.openstack.common import log
|
||||
|
||||
CONF = config.CONF
|
||||
logging.register_options(CONF)
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
config.parse_cache_args()
|
||||
log.setup('glance')
|
||||
logging.setup(CONF, 'glance')
|
||||
|
||||
app = cleaner.Cleaner()
|
||||
app.run()
|
||||
|
@ -34,16 +34,19 @@ if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')):
|
||||
sys.path.insert(0, possible_topdir)
|
||||
|
||||
import glance_store
|
||||
from oslo_log import log as logging
|
||||
|
||||
from glance.common import config
|
||||
from glance.image_cache import prefetcher
|
||||
from glance.openstack.common import log
|
||||
|
||||
CONF = config.CONF
|
||||
logging.register_options(CONF)
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
config.parse_cache_args()
|
||||
log.setup('glance')
|
||||
logging.setup(CONF, 'glance')
|
||||
|
||||
glance_store.register_opts(config.CONF)
|
||||
glance_store.create_stores(config.CONF)
|
||||
|
@ -24,6 +24,8 @@ This is meant to be run as a periodic task, perhaps every half-hour.
|
||||
import os
|
||||
import sys
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
# If ../glance/__init__.py exists, add ../ to Python search path, so that
|
||||
# it will override what happens to be installed in /usr/(local/)lib/python...
|
||||
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
||||
@ -34,13 +36,15 @@ if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')):
|
||||
|
||||
from glance.common import config
|
||||
from glance.image_cache import pruner
|
||||
from glance.openstack.common import log
|
||||
|
||||
CONF = config.CONF
|
||||
logging.register_options(CONF)
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
config.parse_cache_args()
|
||||
log.setup('glance')
|
||||
logging.setup(CONF, 'glance')
|
||||
|
||||
app = pruner.Pruner()
|
||||
app.run()
|
||||
|
@ -40,6 +40,7 @@ if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')):
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_db.sqlalchemy import migration
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import encodeutils
|
||||
import six
|
||||
|
||||
@ -50,11 +51,10 @@ from glance.db import migration as db_migration
|
||||
from glance.db.sqlalchemy import api as db_api
|
||||
from glance.db.sqlalchemy import metadata
|
||||
from glance import i18n
|
||||
from glance.openstack.common import log
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
LOG = log.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
_LW = i18n._LW
|
||||
|
||||
|
||||
@ -285,6 +285,7 @@ def methods_of(obj):
|
||||
def main():
|
||||
CONF.register_cli_opt(command_opt)
|
||||
try:
|
||||
logging.register_options(CONF)
|
||||
cfg_files = cfg.find_config_files(project='glance',
|
||||
prog='glance-registry')
|
||||
cfg_files.extend(cfg.find_config_files(project='glance',
|
||||
@ -293,7 +294,7 @@ def main():
|
||||
prog='glance-manage'))
|
||||
config.parse_args(default_config_files=cfg_files,
|
||||
usage="%(prog)s [options] <cmd>")
|
||||
log.setup('glance')
|
||||
logging.setup(CONF, 'glance')
|
||||
except RuntimeError as e:
|
||||
sys.exit("ERROR: %s" % e)
|
||||
|
||||
|
@ -38,6 +38,7 @@ if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')):
|
||||
sys.path.insert(0, possible_topdir)
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import osprofiler.notifier
|
||||
import osprofiler.web
|
||||
|
||||
@ -45,17 +46,17 @@ from glance.common import config
|
||||
from glance.common import utils
|
||||
from glance.common import wsgi
|
||||
from glance import notifier
|
||||
from glance.openstack.common import log
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_group("profiler", "glance.common.wsgi")
|
||||
logging.register_options(CONF)
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
config.parse_args()
|
||||
wsgi.set_eventlet_hub()
|
||||
log.setup('glance')
|
||||
logging.setup(CONF, 'glance')
|
||||
|
||||
if cfg.CONF.profiler.enabled:
|
||||
_notifier = osprofiler.notifier.create("Messaging",
|
||||
|
@ -24,6 +24,7 @@ import sys
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo_log import log as logging
|
||||
import six.moves.urllib.parse as urlparse
|
||||
from webob import exc
|
||||
|
||||
@ -31,9 +32,8 @@ from glance.common import config
|
||||
from glance.common import exception
|
||||
from glance.common import utils
|
||||
from glance import i18n
|
||||
from glance.openstack.common import log
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
_ = i18n._
|
||||
_LI = i18n._LI
|
||||
_LE = i18n._LE
|
||||
@ -81,6 +81,7 @@ cli_opts = [
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_cli_opts(cli_opts)
|
||||
logging.register_options(CONF)
|
||||
|
||||
# If ../glance/__init__.py exists, add ../ to Python search path, so that
|
||||
# it will override what happens to be installed in /usr/(local/)lib/python...
|
||||
@ -702,7 +703,7 @@ def main():
|
||||
sys.exit("ERROR: %s" % utils.exception_to_str(e))
|
||||
|
||||
# Setup logging
|
||||
log.setup('glance')
|
||||
logging.setup('glance')
|
||||
|
||||
if CONF.token:
|
||||
CONF.slavetoken = CONF.token
|
||||
|
@ -32,13 +32,14 @@ if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')):
|
||||
|
||||
import glance_store
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from glance.common import config
|
||||
from glance.openstack.common import log
|
||||
from glance import scrubber
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
logging.register_options(CONF)
|
||||
|
||||
|
||||
def main():
|
||||
@ -47,7 +48,7 @@ def main():
|
||||
|
||||
try:
|
||||
config.parse_args()
|
||||
log.setup('glance')
|
||||
logging.setup(CONF, 'glance')
|
||||
|
||||
glance_store.register_opts(config.CONF)
|
||||
glance_store.create_stores(config.CONF)
|
||||
|
@ -30,13 +30,13 @@ Keystone (an identity management system).
|
||||
"""
|
||||
import httplib2
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo_log import log as logging
|
||||
# NOTE(jokke): simplified transition to py3, behaves like py2 xrange
|
||||
from six.moves import range
|
||||
import six.moves.urllib.parse as urlparse
|
||||
|
||||
from glance.common import exception
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -40,6 +40,7 @@ try:
|
||||
except ImportError:
|
||||
SENDFILE_SUPPORTED = False
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import encodeutils
|
||||
import six
|
||||
# NOTE(jokke): simplified transition to py3, behaves like py2 xrange
|
||||
@ -50,7 +51,6 @@ from glance.common import auth
|
||||
from glance.common import exception
|
||||
from glance.common import utils
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
_ = i18n._
|
||||
|
@ -16,10 +16,10 @@
|
||||
import copy
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import stevedore
|
||||
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
_ = i18n._
|
||||
_LE = i18n._LE
|
||||
|
@ -20,11 +20,11 @@ except ImportError:
|
||||
from ordereddict import OrderedDict
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
import glance.api.policy
|
||||
from glance.common import exception
|
||||
from glance import i18n
|
||||
from glance.openstack.common import log as logging
|
||||
from glance.openstack.common import policy
|
||||
|
||||
# NOTE(bourke): The default dict_type is collections.OrderedDict in py27, but
|
||||
|
@ -20,6 +20,7 @@ import datetime
|
||||
import traceback
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_utils.importutils as imp
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
@ -30,7 +31,6 @@ from glance.common import exception
|
||||
from glance.common import utils
|
||||
from glance.common import wsgi
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
_ = i18n._
|
||||
|
@ -13,10 +13,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
from glance.common.scripts.image_import import main as image_import
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
|
||||
_LI = i18n._LI
|
||||
|
@ -18,6 +18,7 @@ __all__ = [
|
||||
]
|
||||
|
||||
from oslo_concurrency import lockutils
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
import six
|
||||
|
||||
@ -27,7 +28,6 @@ from glance.common.scripts import utils as script_utils
|
||||
from glance.common import store_utils
|
||||
from glance.common import utils as common_utils
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -24,9 +24,10 @@ __all__ = [
|
||||
|
||||
import urllib2
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
from glance.common import exception
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -16,12 +16,12 @@ import sys
|
||||
|
||||
import glance_store as store_api
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import six.moves.urllib.parse as urlparse
|
||||
|
||||
from glance.common import utils
|
||||
import glance.db as db_api
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
from glance import scrubber
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -19,10 +19,10 @@ except ImportError:
|
||||
from ordereddict import OrderedDict
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from glance.common import exception
|
||||
from glance import i18n
|
||||
from glance.openstack.common import log as logging
|
||||
|
||||
_ = i18n._
|
||||
_LE = i18n._LE
|
||||
|
@ -38,6 +38,7 @@ import uuid
|
||||
|
||||
from OpenSSL import crypto
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import encodeutils
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import netutils
|
||||
@ -47,7 +48,6 @@ from webob import exc
|
||||
|
||||
from glance.common import exception
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
@ -38,6 +38,8 @@ import glance_store
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_log import loggers
|
||||
import routes
|
||||
import routes.middleware
|
||||
import six
|
||||
@ -48,7 +50,6 @@ from webob import multidict
|
||||
from glance.common import exception
|
||||
from glance.common import utils
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
|
||||
_ = i18n._
|
||||
@ -306,7 +307,7 @@ class Server(object):
|
||||
|
||||
os.umask(0o27) # ensure files are created with the correct privileges
|
||||
self._logger = logging.getLogger("eventlet.wsgi.server")
|
||||
self._wsgi_logger = logging.WritableLogger(self._logger)
|
||||
self._wsgi_logger = loggers.WritableLogger(self._logger)
|
||||
|
||||
if CONF.workers == 0:
|
||||
# Useful for profiling, test, debug etc.
|
||||
|
@ -30,7 +30,8 @@ database back-end.
|
||||
|
||||
import functools
|
||||
|
||||
import glance.openstack.common.log as logging
|
||||
from oslo_log import log as logging
|
||||
|
||||
from glance.registry.client.v2 import api
|
||||
|
||||
|
||||
|
@ -19,13 +19,13 @@ import datetime
|
||||
import functools
|
||||
import uuid
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
|
||||
from glance.common import exception
|
||||
from glance.common import utils
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
_ = i18n._
|
||||
|
@ -25,6 +25,7 @@ import threading
|
||||
from oslo_config import cfg
|
||||
from oslo_db import exception as db_exception
|
||||
from oslo_db.sqlalchemy import session
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import timeutils
|
||||
import osprofiler.sqlalchemy
|
||||
from retrying import retry
|
||||
@ -47,11 +48,10 @@ from glance.db.sqlalchemy.metadef_api\
|
||||
from glance.db.sqlalchemy.metadef_api import tag as metadef_tag_api
|
||||
from glance.db.sqlalchemy import models
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as os_logging
|
||||
|
||||
BASE = models.BASE
|
||||
sa_logger = None
|
||||
LOG = os_logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
_ = i18n._
|
||||
_LI = i18n._LI
|
||||
_LW = i18n._LW
|
||||
@ -61,7 +61,6 @@ STATUSES = ['active', 'saving', 'queued', 'killed', 'pending_delete',
|
||||
'deleted']
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('debug', 'glance.openstack.common.log')
|
||||
CONF.import_group("profiler", "glance.common.wsgi")
|
||||
|
||||
_FACADE = None
|
||||
|
@ -24,6 +24,7 @@ from os.path import join
|
||||
import re
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
import sqlalchemy
|
||||
@ -33,7 +34,6 @@ from sqlalchemy.sql import select
|
||||
|
||||
from glance.common import utils
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
_ = i18n._
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_db.sqlalchemy.utils import paginate_query
|
||||
from oslo_log import log as logging
|
||||
import sqlalchemy.exc as sa_exc
|
||||
from sqlalchemy import or_
|
||||
import sqlalchemy.orm as sa_orm
|
||||
@ -22,9 +23,8 @@ from glance.common import exception as exc
|
||||
import glance.db.sqlalchemy.metadef_api as metadef_api
|
||||
from glance.db.sqlalchemy import models_metadef as models
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as os_logging
|
||||
|
||||
LOG = os_logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
_ = i18n._
|
||||
_LW = i18n._LW
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_log import log as logging
|
||||
from sqlalchemy import func
|
||||
import sqlalchemy.orm as sa_orm
|
||||
|
||||
@ -22,9 +23,8 @@ from glance.db.sqlalchemy.metadef_api import namespace as namespace_api
|
||||
import glance.db.sqlalchemy.metadef_api.utils as metadef_utils
|
||||
from glance.db.sqlalchemy import models_metadef as models
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as os_logging
|
||||
|
||||
LOG = os_logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
_ = i18n._
|
||||
_LW = i18n._LW
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_log import log as logging
|
||||
from sqlalchemy import func
|
||||
import sqlalchemy.orm as sa_orm
|
||||
|
||||
@ -22,9 +23,8 @@ from glance.db.sqlalchemy.metadef_api import namespace as namespace_api
|
||||
from glance.db.sqlalchemy.metadef_api import utils as metadef_utils
|
||||
from glance.db.sqlalchemy import models_metadef as models
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as os_logging
|
||||
|
||||
LOG = os_logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
_ = i18n._
|
||||
_LW = i18n._LW
|
||||
|
||||
|
@ -14,15 +14,15 @@
|
||||
|
||||
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_log import log as logging
|
||||
import sqlalchemy.exc as sa_exc
|
||||
import sqlalchemy.orm as sa_orm
|
||||
|
||||
from glance.common import exception as exc
|
||||
import glance.db.sqlalchemy.metadef_api.utils as metadef_utils
|
||||
from glance.db.sqlalchemy import models_metadef as models
|
||||
import glance.openstack.common.log as os_logging
|
||||
|
||||
LOG = os_logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def get(context, name, session):
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_log import log as logging
|
||||
import sqlalchemy.orm as sa_orm
|
||||
|
||||
from glance.common import exception as exc
|
||||
@ -24,9 +25,8 @@ from glance.db.sqlalchemy.metadef_api\
|
||||
from glance.db.sqlalchemy.metadef_api\
|
||||
import utils as metadef_utils
|
||||
from glance.db.sqlalchemy import models_metadef as models
|
||||
import glance.openstack.common.log as os_logging
|
||||
|
||||
LOG = os_logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def _to_db_dict(namespace_id, resource_type_id, model_dict):
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_db.sqlalchemy.utils import paginate_query
|
||||
from oslo_log import log as logging
|
||||
from sqlalchemy import func
|
||||
import sqlalchemy.orm as sa_orm
|
||||
|
||||
@ -23,9 +24,8 @@ from glance.db.sqlalchemy.metadef_api import namespace as namespace_api
|
||||
import glance.db.sqlalchemy.metadef_api.utils as metadef_utils
|
||||
from glance.db.sqlalchemy import models_metadef as models
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as os_logging
|
||||
|
||||
LOG = os_logging.getLogger(__name__)
|
||||
LOG = logging.getLogger(__name__)
|
||||
_LW = i18n._LW
|
||||
|
||||
|
||||
|
@ -17,10 +17,10 @@
|
||||
Various conveniences used for migration scripts
|
||||
"""
|
||||
|
||||
from oslo_log import log as logging
|
||||
import sqlalchemy.types
|
||||
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -13,13 +13,13 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_log import log as logging
|
||||
import six.moves.urllib.parse as urlparse
|
||||
import sqlalchemy
|
||||
|
||||
from glance.common import exception
|
||||
from glance.common import utils
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
_ = i18n._
|
||||
|
@ -31,6 +31,7 @@ import types # noqa
|
||||
# NOTE(flaper87): This is bad but there ain't better way to do it.
|
||||
from glance_store._drivers import swift # noqa
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import six.moves.urllib.parse as urlparse
|
||||
import sqlalchemy
|
||||
|
||||
@ -38,7 +39,6 @@ from glance.common import crypt
|
||||
from glance.common import exception
|
||||
from glance.common import utils
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
_ = i18n._
|
||||
|
@ -19,6 +19,7 @@ import datetime
|
||||
import uuid
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import timeutils
|
||||
@ -26,7 +27,6 @@ import six
|
||||
|
||||
from glance.common import exception
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
_ = i18n._
|
||||
_LE = i18n._LE
|
||||
|
@ -20,6 +20,7 @@ LRU Cache for Image Data
|
||||
import hashlib
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import units
|
||||
@ -27,7 +28,6 @@ from oslo_utils import units
|
||||
from glance.common import exception
|
||||
from glance.common import utils
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
_ = i18n._
|
||||
|
@ -20,11 +20,11 @@ Base attribute driver class
|
||||
import os.path
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from glance.common import exception
|
||||
from glance.common import utils
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
_ = i18n._
|
||||
|
@ -27,12 +27,12 @@ import time
|
||||
from eventlet import sleep
|
||||
from eventlet import timeout
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
|
||||
from glance.common import exception
|
||||
from glance import i18n
|
||||
from glance.image_cache.drivers import base
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
_ = i18n._
|
||||
|
@ -59,6 +59,7 @@ import stat
|
||||
import time
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
import xattr
|
||||
|
||||
@ -66,7 +67,6 @@ from glance.common import exception
|
||||
from glance.common import utils
|
||||
from glance import i18n
|
||||
from glance.image_cache.drivers import base
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
_LE = i18n._LE
|
||||
|
@ -16,14 +16,15 @@
|
||||
"""
|
||||
Prefetches images into the Image Cache
|
||||
"""
|
||||
|
||||
import eventlet
|
||||
import glance_store
|
||||
from oslo_log import log as logging
|
||||
|
||||
from glance.common import exception
|
||||
from glance import context
|
||||
from glance import i18n
|
||||
from glance.image_cache import base
|
||||
import glance.openstack.common.log as logging
|
||||
import glance.registry.client.v1.api as registry
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -18,13 +18,13 @@ import copy
|
||||
|
||||
import glance_store as store
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
|
||||
from glance.common import exception
|
||||
from glance.common import utils
|
||||
import glance.domain.proxy
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
|
||||
_ = i18n._
|
||||
|
@ -19,6 +19,7 @@ import abc
|
||||
import glance_store
|
||||
from oslo import messaging
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
@ -28,7 +29,6 @@ from glance.common import exception
|
||||
from glance.common import utils
|
||||
from glance.domain import proxy as domain_proxy
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
_ = i18n._
|
||||
|
||||
|
@ -1,710 +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 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 glance.openstack.common._i18n import _
|
||||
from glance.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)
|
||||
|
||||
# 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:
|
||||
try:
|
||||
handler = importutils.import_object(
|
||||
"glance.openstack.common.log_handler.PublishErrorsHandler",
|
||||
logging.ERROR)
|
||||
except ImportError:
|
||||
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(facility=facility)
|
||||
else:
|
||||
syslog = logging.handlers.SysLogHandler(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))
|
@ -34,7 +34,6 @@ import glance.common.wsgi
|
||||
import glance.image_cache
|
||||
import glance.image_cache.drivers.sqlite
|
||||
import glance.notifier
|
||||
import glance.openstack.common.log
|
||||
import glance.openstack.common.policy
|
||||
import glance.registry
|
||||
import glance.registry.client
|
||||
@ -42,12 +41,8 @@ import glance.registry.client.v1.api
|
||||
import glance.scrubber
|
||||
|
||||
|
||||
_global_opt_lists = [
|
||||
glance.openstack.common.log.common_cli_opts,
|
||||
glance.openstack.common.log.logging_cli_opts,
|
||||
]
|
||||
_api_opts = [
|
||||
(None, list(itertools.chain(*(_global_opt_lists + [
|
||||
(None, list(itertools.chain(
|
||||
glance.api.middleware.context.context_opts,
|
||||
glance.api.versions.versions_opts,
|
||||
glance.common.config.common_opts,
|
||||
@ -65,7 +60,7 @@ _api_opts = [
|
||||
glance.registry.client.registry_client_opts,
|
||||
glance.registry.client.v1.api.registry_client_ctx_opts,
|
||||
glance.openstack.common.policy.policy_opts,
|
||||
glance.scrubber.scrubber_opts])))),
|
||||
glance.scrubber.scrubber_opts))),
|
||||
('image_format', glance.common.config.image_format_opts),
|
||||
('task', glance.common.config.task_opts),
|
||||
('store_type_location_strategy',
|
||||
@ -73,37 +68,37 @@ _api_opts = [
|
||||
('paste_deploy', glance.common.config.paste_deploy_opts)
|
||||
]
|
||||
_registry_opts = [
|
||||
(None, list(itertools.chain(*(_global_opt_lists + [
|
||||
(None, list(itertools.chain(
|
||||
glance.api.middleware.context.context_opts,
|
||||
glance.common.config.common_opts,
|
||||
glance.common.wsgi.bind_opts,
|
||||
glance.common.wsgi.socket_opts,
|
||||
glance.common.wsgi.eventlet_opts,
|
||||
glance.openstack.common.policy.policy_opts])))),
|
||||
glance.openstack.common.policy.policy_opts))),
|
||||
('paste_deploy', glance.common.config.paste_deploy_opts)
|
||||
]
|
||||
_scrubber_opts = [
|
||||
(None, list(itertools.chain(*(_global_opt_lists + [
|
||||
(None, list(itertools.chain(
|
||||
glance.common.config.common_opts,
|
||||
glance.openstack.common.policy.policy_opts,
|
||||
glance.scrubber.scrubber_opts,
|
||||
glance.scrubber.scrubber_cmd_opts,
|
||||
glance.scrubber.scrubber_cmd_cli_opts,
|
||||
glance.registry.client.registry_client_ctx_opts,
|
||||
glance.registry.registry_addr_opts])))),
|
||||
glance.registry.registry_addr_opts))),
|
||||
]
|
||||
_cache_opts = [
|
||||
(None, list(itertools.chain(*(_global_opt_lists + [
|
||||
(None, list(itertools.chain(
|
||||
glance.common.config.common_opts,
|
||||
glance.openstack.common.policy.policy_opts,
|
||||
glance.image_cache.drivers.sqlite.sqlite_opts,
|
||||
glance.image_cache.image_cache_opts,
|
||||
glance.registry.registry_addr_opts,
|
||||
glance.registry.client.registry_client_ctx_opts])))),
|
||||
glance.registry.client.registry_client_ctx_opts))),
|
||||
]
|
||||
_manage_opts = [
|
||||
(None, list(itertools.chain(*(_global_opt_lists + [
|
||||
glance.common.config.manage_opts]))))
|
||||
(None, list(itertools.chain(
|
||||
glance.common.config.manage_opts)))
|
||||
]
|
||||
|
||||
|
||||
|
@ -16,6 +16,7 @@ import copy
|
||||
|
||||
import glance_store as store
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
import six
|
||||
|
||||
@ -25,7 +26,6 @@ from glance.common import utils
|
||||
import glance.domain
|
||||
import glance.domain.proxy
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -18,6 +18,7 @@ Reference implementation registry server WSGI controller
|
||||
"""
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import strutils
|
||||
from oslo_utils import timeutils
|
||||
from webob import exc
|
||||
@ -27,7 +28,6 @@ from glance.common import utils
|
||||
from glance.common import wsgi
|
||||
import glance.db
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_log import log as logging
|
||||
import webob.exc
|
||||
|
||||
from glance.common import exception
|
||||
@ -20,7 +21,6 @@ from glance.common import utils
|
||||
from glance.common import wsgi
|
||||
import glance.db
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -18,12 +18,12 @@ RPC Controller
|
||||
"""
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from glance.common import rpc
|
||||
from glance.common import wsgi
|
||||
import glance.db
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -21,10 +21,10 @@ import os
|
||||
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from glance.common import exception
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
from glance.registry.client.v1 import client
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -19,12 +19,12 @@ the Glance Registry API
|
||||
"""
|
||||
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
|
||||
from glance.common.client import BaseClient
|
||||
from glance.common import crypt
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
from glance.registry.api.v1 import images
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -20,10 +20,10 @@ Registry's Client V2
|
||||
import os
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from glance.common import exception
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
from glance.registry.client.v2 import client
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -18,8 +18,9 @@ Simple client class to speak with any RESTful service that implements
|
||||
the Glance Registry API
|
||||
"""
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
from glance.common import rpc
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -21,6 +21,7 @@ import time
|
||||
import eventlet
|
||||
from oslo_concurrency import lockutils
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from glance.common import crypt
|
||||
@ -29,7 +30,6 @@ from glance.common import utils
|
||||
from glance import context
|
||||
import glance.db as db_api
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
import glance.registry.client.v1.api as registry
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -14,6 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
import webob.exc
|
||||
from wsme.rest import json
|
||||
@ -30,7 +31,6 @@ import glance.db
|
||||
import glance.gateway
|
||||
from glance import i18n
|
||||
import glance.notifier
|
||||
import glance.openstack.common.log as logging
|
||||
import glance.schema
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -14,6 +14,7 @@ import sys
|
||||
import glance_store as store
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
import glance.cmd.api
|
||||
@ -81,7 +82,7 @@ class TestGlanceApiCmd(test_utils.BaseTestCase):
|
||||
self.assertEqual(2, exit.code)
|
||||
|
||||
@mock.patch.object(glance.common.config, 'parse_cache_args')
|
||||
@mock.patch.object(glance.openstack.common.log, 'setup')
|
||||
@mock.patch.object(logging, 'setup')
|
||||
@mock.patch.object(glance.image_cache.ImageCache, 'init_driver')
|
||||
@mock.patch.object(glance.image_cache.ImageCache, 'clean')
|
||||
def test_cache_cleaner_main(self, mock_cache_clean,
|
||||
@ -96,7 +97,7 @@ class TestGlanceApiCmd(test_utils.BaseTestCase):
|
||||
manager.attach_mock(mock_cache_clean, 'mock_cache_clean')
|
||||
glance.cmd.cache_cleaner.main()
|
||||
expected_call_sequence = [mock.call.mock_parse_config(),
|
||||
mock.call.mock_log_setup('glance'),
|
||||
mock.call.mock_log_setup(CONF, 'glance'),
|
||||
mock.call.mock_cache_init_driver(),
|
||||
mock.call.mock_cache_clean()]
|
||||
self.assertEqual(expected_call_sequence, manager.mock_calls)
|
||||
@ -110,7 +111,7 @@ class TestGlanceApiCmd(test_utils.BaseTestCase):
|
||||
self.assertEqual('ERROR: ', exit.code)
|
||||
|
||||
@mock.patch.object(glance.common.config, 'parse_cache_args')
|
||||
@mock.patch.object(glance.openstack.common.log, 'setup')
|
||||
@mock.patch.object(logging, 'setup')
|
||||
@mock.patch.object(glance.image_cache.ImageCache, 'init_driver')
|
||||
@mock.patch.object(glance.image_cache.ImageCache, 'prune')
|
||||
def test_cache_pruner_main(self, mock_cache_prune,
|
||||
@ -125,7 +126,7 @@ class TestGlanceApiCmd(test_utils.BaseTestCase):
|
||||
manager.attach_mock(mock_cache_prune, 'mock_cache_prune')
|
||||
glance.cmd.cache_pruner.main()
|
||||
expected_call_sequence = [mock.call.mock_parse_config(),
|
||||
mock.call.mock_log_setup('glance'),
|
||||
mock.call.mock_log_setup(CONF, 'glance'),
|
||||
mock.call.mock_cache_init_driver(),
|
||||
mock.call.mock_cache_prune()]
|
||||
self.assertEqual(expected_call_sequence, manager.mock_calls)
|
||||
|
@ -46,7 +46,7 @@ class TestManageBase(testtools.TestCase):
|
||||
pass
|
||||
|
||||
self.useFixture(fixtures.MonkeyPatch(
|
||||
'glance.openstack.common.log.setup', setup))
|
||||
'oslo_log.setup', setup))
|
||||
manage.main()
|
||||
func_name.assert_called_once_with(*exp_args, **exp_kwargs)
|
||||
|
||||
|
@ -61,16 +61,6 @@ class OptsTestCase(utils.BaseTestCase):
|
||||
'paste_deploy'
|
||||
]
|
||||
expected_opt_names = [
|
||||
'debug',
|
||||
'verbose',
|
||||
'log-config-append',
|
||||
'log-format',
|
||||
'log-date-format',
|
||||
'log-file',
|
||||
'log-dir',
|
||||
'use-syslog',
|
||||
'use-syslog-rfc-format',
|
||||
'syslog-log-facility',
|
||||
'owner_is_tenant',
|
||||
'admin_role',
|
||||
'allow_anonymous_access',
|
||||
@ -162,16 +152,6 @@ class OptsTestCase(utils.BaseTestCase):
|
||||
'paste_deploy'
|
||||
]
|
||||
expected_opt_names = [
|
||||
'debug',
|
||||
'verbose',
|
||||
'log-config-append',
|
||||
'log-format',
|
||||
'log-date-format',
|
||||
'log-file',
|
||||
'log-dir',
|
||||
'use-syslog',
|
||||
'use-syslog-rfc-format',
|
||||
'syslog-log-facility',
|
||||
'owner_is_tenant',
|
||||
'admin_role',
|
||||
'allow_anonymous_access',
|
||||
@ -223,16 +203,6 @@ class OptsTestCase(utils.BaseTestCase):
|
||||
None
|
||||
]
|
||||
expected_opt_names = [
|
||||
'debug',
|
||||
'verbose',
|
||||
'log-config-append',
|
||||
'log-format',
|
||||
'log-date-format',
|
||||
'log-file',
|
||||
'log-dir',
|
||||
'use-syslog',
|
||||
'use-syslog-rfc-format',
|
||||
'syslog-log-facility',
|
||||
'policy_file',
|
||||
'policy_default_rule',
|
||||
'policy_dirs',
|
||||
@ -285,16 +255,6 @@ class OptsTestCase(utils.BaseTestCase):
|
||||
None
|
||||
]
|
||||
expected_opt_names = [
|
||||
'debug',
|
||||
'verbose',
|
||||
'log-config-append',
|
||||
'log-format',
|
||||
'log-date-format',
|
||||
'log-file',
|
||||
'log-dir',
|
||||
'use-syslog',
|
||||
'use-syslog-rfc-format',
|
||||
'syslog-log-facility',
|
||||
'policy_file',
|
||||
'policy_default_rule',
|
||||
'policy_dirs',
|
||||
@ -345,16 +305,6 @@ class OptsTestCase(utils.BaseTestCase):
|
||||
None,
|
||||
]
|
||||
expected_opt_names = [
|
||||
'debug',
|
||||
'verbose',
|
||||
'log-config-append',
|
||||
'log-format',
|
||||
'log-date-format',
|
||||
'log-file',
|
||||
'log-dir',
|
||||
'use-syslog',
|
||||
'use-syslog-rfc-format',
|
||||
'syslog-log-facility',
|
||||
'db_enforce_mysql_charset'
|
||||
]
|
||||
|
||||
|
@ -17,6 +17,7 @@ import urllib
|
||||
|
||||
import glance_store as store
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import six.moves.urllib.parse as urlparse
|
||||
|
||||
from glance.common import exception
|
||||
@ -24,7 +25,6 @@ from glance.common import store_utils
|
||||
from glance.common import wsgi
|
||||
import glance.context
|
||||
import glance.db.simple.api as simple_db
|
||||
import glance.openstack.common.log as logging
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
# The list of modules to copy from oslo-incubator
|
||||
module=install_venv_common
|
||||
module=log
|
||||
module=policy
|
||||
module=service
|
||||
|
||||
|
@ -51,6 +51,7 @@ six>=1.9.0
|
||||
|
||||
oslo.db>=1.5.0 # Apache-2.0
|
||||
oslo.i18n>=1.3.0 # Apache-2.0
|
||||
oslo.log>=0.4.0 # Apache-2.0
|
||||
oslo.messaging>=1.6.0 # Apache-2.0
|
||||
oslo.serialization>=1.2.0 # Apache-2.0
|
||||
|
||||
|
@ -17,11 +17,11 @@ import sys
|
||||
|
||||
import keystoneclient.v2_0.client
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
import glance.context
|
||||
import glance.db.sqlalchemy.api as db_api
|
||||
from glance import i18n
|
||||
import glance.openstack.common.log as logging
|
||||
import glance.registry.context
|
||||
|
||||
_ = i18n._
|
||||
|
Loading…
Reference in New Issue
Block a user