Deprecate logging options
Gnocchi is moving away from oslo.log to using daiquiri[1] Lets deprecate the options that dont make sense anymore. [1] http://github.com/jd/daiquiri Change-Id: I0b8e324f40ac35f2f7f7f1234b8183eb40a8a64d
This commit is contained in:
@@ -26,6 +26,8 @@
|
|||||||
# any directory.
|
# any directory.
|
||||||
# Defaults to '/var/log/gnocchi'
|
# Defaults to '/var/log/gnocchi'
|
||||||
#
|
#
|
||||||
|
# DEPRECATED PARAMETERS
|
||||||
|
#
|
||||||
# [*logging_context_format_string*]
|
# [*logging_context_format_string*]
|
||||||
# (optional) format string to use for log messages with context.
|
# (optional) format string to use for log messages with context.
|
||||||
# Defaults to $::os_service_default
|
# Defaults to $::os_service_default
|
||||||
@@ -92,6 +94,7 @@ class gnocchi::logging(
|
|||||||
$log_facility = $::os_service_default,
|
$log_facility = $::os_service_default,
|
||||||
$log_dir = '/var/log/gnocchi',
|
$log_dir = '/var/log/gnocchi',
|
||||||
$debug = $::os_service_default,
|
$debug = $::os_service_default,
|
||||||
|
# DEPRECATED
|
||||||
$logging_context_format_string = $::os_service_default,
|
$logging_context_format_string = $::os_service_default,
|
||||||
$logging_default_format_string = $::os_service_default,
|
$logging_default_format_string = $::os_service_default,
|
||||||
$logging_debug_format_suffix = $::os_service_default,
|
$logging_debug_format_suffix = $::os_service_default,
|
||||||
@@ -107,6 +110,50 @@ class gnocchi::logging(
|
|||||||
|
|
||||||
include ::gnocchi::deps
|
include ::gnocchi::deps
|
||||||
|
|
||||||
|
if $logging_context_format_string {
|
||||||
|
warning('gnocchi::logging::logging_context_format_string is deprecated and will be removed in future')
|
||||||
|
}
|
||||||
|
|
||||||
|
if $logging_default_format_string {
|
||||||
|
warning('gnocchi::logging::logging_default_format_string is deprecated and will be removed in future')
|
||||||
|
}
|
||||||
|
|
||||||
|
if $logging_debug_format_suffix {
|
||||||
|
warning('gnocchi::logging::logging_debug_format_suffix is deprecated and will be removed in future')
|
||||||
|
}
|
||||||
|
|
||||||
|
if $logging_exception_prefix {
|
||||||
|
warning('gnocchi::logging::logging_exception_prefix is deprecated and will be removed in future')
|
||||||
|
}
|
||||||
|
|
||||||
|
if $log_config_append {
|
||||||
|
warning('gnocchi::logging::log_config_append is deprecated and will be removed in future')
|
||||||
|
}
|
||||||
|
|
||||||
|
if $default_log_levels {
|
||||||
|
warning('gnocchi::logging::default_log_levels is deprecated and will be removed in future')
|
||||||
|
}
|
||||||
|
|
||||||
|
if $publish_errors {
|
||||||
|
warning('gnocchi::logging::publish_errors is deprecated and will be removed in future')
|
||||||
|
}
|
||||||
|
|
||||||
|
if $fatal_deprecations {
|
||||||
|
warning('gnocchi::logging::fatal_deprecations is deprecated and will be removed in future')
|
||||||
|
}
|
||||||
|
|
||||||
|
if $instance_format {
|
||||||
|
warning('gnocchi::logging::instance_format is deprecated and will be removed in future')
|
||||||
|
}
|
||||||
|
|
||||||
|
if $instance_uuid_format {
|
||||||
|
warning('gnocchi::logging::instance_uuid_format is deprecated and will be removed in future')
|
||||||
|
}
|
||||||
|
|
||||||
|
if $log_date_format {
|
||||||
|
warning('gnocchi::logging::log_date_format is deprecated and will be removed in future')
|
||||||
|
}
|
||||||
|
|
||||||
# note(spredzy): in order to keep backward compatibility we rely on the pick function
|
# note(spredzy): in order to keep backward compatibility we rely on the pick function
|
||||||
# to use gnocchi::<myparam> first then gnocchi::logging::<myparam>.
|
# to use gnocchi::<myparam> first then gnocchi::logging::<myparam>.
|
||||||
$use_syslog_real = pick($::gnocchi::use_syslog,$use_syslog)
|
$use_syslog_real = pick($::gnocchi::use_syslog,$use_syslog)
|
||||||
@@ -116,22 +163,11 @@ class gnocchi::logging(
|
|||||||
$debug_real = pick($::gnocchi::debug,$debug)
|
$debug_real = pick($::gnocchi::debug,$debug)
|
||||||
|
|
||||||
oslo::log { 'gnocchi_config':
|
oslo::log { 'gnocchi_config':
|
||||||
debug => $debug_real,
|
debug => $debug_real,
|
||||||
use_syslog => $use_syslog_real,
|
use_syslog => $use_syslog_real,
|
||||||
use_stderr => $use_stderr_real,
|
use_stderr => $use_stderr_real,
|
||||||
log_dir => $log_dir_real,
|
log_dir => $log_dir_real,
|
||||||
syslog_log_facility => $log_facility_real,
|
syslog_log_facility => $log_facility_real,
|
||||||
logging_context_format_string => $logging_context_format_string,
|
|
||||||
logging_default_format_string => $logging_default_format_string,
|
|
||||||
logging_debug_format_suffix => $logging_debug_format_suffix,
|
|
||||||
logging_exception_prefix => $logging_exception_prefix,
|
|
||||||
log_config_append => $log_config_append,
|
|
||||||
default_log_levels => $default_log_levels,
|
|
||||||
publish_errors => $publish_errors,
|
|
||||||
fatal_deprecations => $fatal_deprecations,
|
|
||||||
instance_format => $instance_format,
|
|
||||||
instance_uuid_format => $instance_uuid_format,
|
|
||||||
log_date_format => $log_date_format,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
deprecations:
|
||||||
|
- Deprecating some oslo.log options from logging class. Gnocchi is moving
|
||||||
|
away from oslo.log to daiquri.
|
@@ -9,20 +9,6 @@ describe 'gnocchi::logging' do
|
|||||||
|
|
||||||
let :log_params do
|
let :log_params do
|
||||||
{
|
{
|
||||||
:logging_context_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s',
|
|
||||||
:logging_default_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s',
|
|
||||||
:logging_debug_format_suffix => '%(funcName)s %(pathname)s:%(lineno)d',
|
|
||||||
:logging_exception_prefix => '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s',
|
|
||||||
:log_config_append => '/etc/gnocchi/logging.conf',
|
|
||||||
:publish_errors => true,
|
|
||||||
:default_log_levels => {
|
|
||||||
'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN',
|
|
||||||
'sqlalchemy' => 'WARN', 'suds' => 'INFO', 'iso8601' => 'WARN',
|
|
||||||
'requests.packages.urllib3.connectionpool' => 'WARN' },
|
|
||||||
:fatal_deprecations => true,
|
|
||||||
:instance_format => '[instance: %(uuid)s] ',
|
|
||||||
:instance_uuid_format => '[instance: %(uuid)s] ',
|
|
||||||
:log_date_format => '%Y-%m-%d %H:%M:%S',
|
|
||||||
:use_syslog => true,
|
:use_syslog => true,
|
||||||
:use_stderr => false,
|
:use_stderr => false,
|
||||||
:log_facility => 'LOG_FOO',
|
:log_facility => 'LOG_FOO',
|
||||||
@@ -42,15 +28,6 @@ describe 'gnocchi::logging' do
|
|||||||
it_configures 'basic non-default logging settings'
|
it_configures 'basic non-default logging settings'
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with extended logging options' do
|
|
||||||
before { params.merge!( log_params ) }
|
|
||||||
it_configures 'logging params set'
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'without extended logging options' do
|
|
||||||
it_configures 'logging params unset'
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_examples 'basic default logging settings' do
|
shared_examples 'basic default logging settings' do
|
||||||
@@ -77,39 +54,6 @@ describe 'gnocchi::logging' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_examples_for 'logging params set' do
|
|
||||||
it 'enables logging params' do
|
|
||||||
is_expected.to contain_oslo__log('gnocchi_config').with(
|
|
||||||
:logging_context_format_string =>
|
|
||||||
'%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s',
|
|
||||||
:logging_default_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s',
|
|
||||||
:logging_debug_format_suffix => '%(funcName)s %(pathname)s:%(lineno)d',
|
|
||||||
:logging_exception_prefix => '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s',
|
|
||||||
:log_config_append => '/etc/gnocchi/logging.conf',
|
|
||||||
:publish_errors => true,
|
|
||||||
:default_log_levels => {
|
|
||||||
'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN',
|
|
||||||
'sqlalchemy' => 'WARN', 'suds' => 'INFO', 'iso8601' => 'WARN',
|
|
||||||
'requests.packages.urllib3.connectionpool' => 'WARN' },
|
|
||||||
:fatal_deprecations => true,
|
|
||||||
:instance_format => '[instance: %(uuid)s] ',
|
|
||||||
:instance_uuid_format => '[instance: %(uuid)s] ',
|
|
||||||
:log_date_format => '%Y-%m-%d %H:%M:%S',
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
shared_examples_for 'logging params unset' do
|
|
||||||
[ :logging_context_format_string, :logging_default_format_string,
|
|
||||||
:logging_debug_format_suffix, :logging_exception_prefix,
|
|
||||||
:log_config_append, :publish_errors,
|
|
||||||
:default_log_levels, :fatal_deprecations,
|
|
||||||
:instance_format, :instance_uuid_format,
|
|
||||||
:log_date_format, ].each { |param|
|
|
||||||
it { is_expected.to contain_oslo__log('gnocchi_config').with("#{param}" => '<SERVICE DEFAULT>') }
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
on_supported_os({
|
on_supported_os({
|
||||||
:supported_os => OSDefaults.get_supported_os
|
:supported_os => OSDefaults.get_supported_os
|
||||||
}).each do |os,facts|
|
}).each do |os,facts|
|
||||||
|
Reference in New Issue
Block a user