From 48ab267d686a9ec5e364df3b8c368fa628afe0b8 Mon Sep 17 00:00:00 2001 From: Pradeep Kilambi Date: Wed, 7 Jun 2017 14:35:16 -0400 Subject: [PATCH] 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 --- manifests/logging.pp | 68 ++++++++++++++----- ...cate-oslo-log-params-12ed30a5db0e5baf.yaml | 4 ++ spec/classes/gnocchi_logging_spec.rb | 56 --------------- 3 files changed, 56 insertions(+), 72 deletions(-) create mode 100644 releasenotes/notes/deprecate-oslo-log-params-12ed30a5db0e5baf.yaml diff --git a/manifests/logging.pp b/manifests/logging.pp index 26228fb6..c192c9ca 100644 --- a/manifests/logging.pp +++ b/manifests/logging.pp @@ -26,6 +26,8 @@ # any directory. # Defaults to '/var/log/gnocchi' # +# DEPRECATED PARAMETERS +# # [*logging_context_format_string*] # (optional) format string to use for log messages with context. # Defaults to $::os_service_default @@ -92,6 +94,7 @@ class gnocchi::logging( $log_facility = $::os_service_default, $log_dir = '/var/log/gnocchi', $debug = $::os_service_default, + # DEPRECATED $logging_context_format_string = $::os_service_default, $logging_default_format_string = $::os_service_default, $logging_debug_format_suffix = $::os_service_default, @@ -107,6 +110,50 @@ class gnocchi::logging( 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 # to use gnocchi:: first then gnocchi::logging::. $use_syslog_real = pick($::gnocchi::use_syslog,$use_syslog) @@ -116,22 +163,11 @@ class gnocchi::logging( $debug_real = pick($::gnocchi::debug,$debug) oslo::log { 'gnocchi_config': - debug => $debug_real, - use_syslog => $use_syslog_real, - use_stderr => $use_stderr_real, - log_dir => $log_dir_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, + debug => $debug_real, + use_syslog => $use_syslog_real, + use_stderr => $use_stderr_real, + log_dir => $log_dir_real, + syslog_log_facility => $log_facility_real, } } diff --git a/releasenotes/notes/deprecate-oslo-log-params-12ed30a5db0e5baf.yaml b/releasenotes/notes/deprecate-oslo-log-params-12ed30a5db0e5baf.yaml new file mode 100644 index 00000000..a76d0e5f --- /dev/null +++ b/releasenotes/notes/deprecate-oslo-log-params-12ed30a5db0e5baf.yaml @@ -0,0 +1,4 @@ +--- +deprecations: + - Deprecating some oslo.log options from logging class. Gnocchi is moving + away from oslo.log to daiquri. diff --git a/spec/classes/gnocchi_logging_spec.rb b/spec/classes/gnocchi_logging_spec.rb index e0f0a92f..0ab5cffe 100644 --- a/spec/classes/gnocchi_logging_spec.rb +++ b/spec/classes/gnocchi_logging_spec.rb @@ -9,20 +9,6 @@ describe 'gnocchi::logging' 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_stderr => false, :log_facility => 'LOG_FOO', @@ -42,15 +28,6 @@ describe 'gnocchi::logging' do it_configures 'basic non-default logging settings' 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 shared_examples 'basic default logging settings' do @@ -77,39 +54,6 @@ describe 'gnocchi::logging' do 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}" => '') } - } - end - on_supported_os({ :supported_os => OSDefaults.get_supported_os }).each do |os,facts|