Merge "Allow multiple log handlers"

This commit is contained in:
Zuul 2020-05-27 20:07:23 +00:00 committed by Gerrit Code Review
commit 36d00a8f26
4 changed files with 47 additions and 19 deletions

View File

@ -92,8 +92,8 @@
# (optional) Specify a maximum number of items to display in a dropdown. # (optional) Specify a maximum number of items to display in a dropdown.
# Defaults to 30 # Defaults to 30
# #
# [*log_handler*] # [*log_handlers*]
# (optional) Log handler. Defaults to 'file' # (optional) Log handlers. Defaults to ['file']
# #
# [*log_level*] # [*log_level*]
# (optional) Log level. Defaults to 'INFO'. WARNING: Setting this to # (optional) Log level. Defaults to 'INFO'. WARNING: Setting this to
@ -450,6 +450,11 @@
# will disable the function in Horizon, direct will allow the user agent to directly # will disable the function in Horizon, direct will allow the user agent to directly
# talk to the glance-api. # talk to the glance-api.
# #
# DEPRECATED PARAMETERS
#
# [*log_handler*]
# (optional) Log handler. Defaults to 'file'
#
# === Examples # === Examples
# #
# class { 'horizon': # class { 'horizon':
@ -480,7 +485,7 @@ class horizon(
$available_regions = undef, $available_regions = undef,
$api_result_limit = 1000, $api_result_limit = 1000,
$dropdown_max_items = 30, $dropdown_max_items = 30,
$log_handler = 'file', $log_handlers = ['file'],
$log_level = 'INFO', $log_level = 'INFO',
$help_url = 'http://docs.openstack.org', $help_url = 'http://docs.openstack.org',
$local_settings_template = 'horizon/local_settings.py.erb', $local_settings_template = 'horizon/local_settings.py.erb',
@ -543,10 +548,21 @@ class horizon(
$enable_user_pass = true, $enable_user_pass = true,
$customization_module = undef, $customization_module = undef,
$horizon_upload_mode = undef, $horizon_upload_mode = undef,
# DEPRECATED PARAMETERS
$log_handler = undef,
) inherits ::horizon::params { ) inherits ::horizon::params {
include horizon::deps include horizon::deps
if $log_handler != undef {
warning('log_handler parameter was deprecated and will be removed in a future \
release. Use log_handlers instead')
$log_handlers_real = [$log_handler]
} else {
validate_legacy(Array, 'validate_array', $log_handlers)
$log_handlers_real = $log_handlers
}
if $cache_server_url and $cache_server_ip { if $cache_server_url and $cache_server_ip {
fail('Only one of cache_server_url or cache_server_ip can be set.') fail('Only one of cache_server_url or cache_server_ip can be set.')
} }

View File

@ -0,0 +1,11 @@
---
features:
- |
The new ``horizon::log_handlers`` parameter was added to specify multiple
log handlers.
deprecations:
- |
The ``horizon::log_handler`` parameter has been deprecated in favor of
the ``horizon::log_handlers`` parameter and will be removed in a future
release.

View File

@ -78,6 +78,7 @@ describe 'horizon' do
'API_RESULT_LIMIT = 1000', 'API_RESULT_LIMIT = 1000',
'DROPDOWN_MAX_ITEMS = 30', 'DROPDOWN_MAX_ITEMS = 30',
'TIME_ZONE = "UTC"', 'TIME_ZONE = "UTC"',
" 'handlers': ['file'],",
'COMPRESS_OFFLINE = True', 'COMPRESS_OFFLINE = True',
"FILE_UPLOAD_TEMP_DIR = '/tmp'", "FILE_UPLOAD_TEMP_DIR = '/tmp'",
"OPENSTACK_HEAT_STACK = {", "OPENSTACK_HEAT_STACK = {",
@ -105,7 +106,7 @@ describe 'horizon' do
:keystone_default_role => 'SwiftOperator', :keystone_default_role => 'SwiftOperator',
:keystone_url => 'https://keystone.example.com:4682', :keystone_url => 'https://keystone.example.com:4682',
:ssl_no_verify => true, :ssl_no_verify => true,
:log_handler => 'syslog', :log_handlers => ['console', 'syslog'],
:log_level => 'DEBUG', :log_level => 'DEBUG',
:openstack_endpoint_type => 'internalURL', :openstack_endpoint_type => 'internalURL',
:secondary_endpoint_type => 'ANY-VALUE', :secondary_endpoint_type => 'ANY-VALUE',
@ -209,7 +210,7 @@ describe 'horizon' do
"]", "]",
"DEFAULT_THEME = 'default'", "DEFAULT_THEME = 'default'",
" 'level': 'DEBUG',", " 'level': 'DEBUG',",
" 'handlers': ['syslog'],", " 'handlers': ['console', 'syslog'],",
"SESSION_TIMEOUT = 1800", "SESSION_TIMEOUT = 1800",
'COMPRESS_OFFLINE = False', 'COMPRESS_OFFLINE = False',
"FILE_UPLOAD_TEMP_DIR = '/var/spool/horizon'", "FILE_UPLOAD_TEMP_DIR = '/var/spool/horizon'",

View File

@ -721,7 +721,7 @@ LOGGING = {
'filename': '<%= scope.lookupvar("horizon::params::logdir") %>/horizon.log', 'filename': '<%= scope.lookupvar("horizon::params::logdir") %>/horizon.log',
'formatter': 'verbose', 'formatter': 'verbose',
}, },
<%- if @log_handler == 'syslog' -%> <%- if @log_handlers_real.include?('syslog') -%>
'syslog': { 'syslog': {
'level': '<%= @log_level %>', 'level': '<%= @log_level %>',
'facility': 'local1', 'facility': 'local1',
@ -744,91 +744,91 @@ LOGGING = {
}, },
'horizon': { 'horizon': {
# 'handlers': ['console'], # 'handlers': ['console'],
'handlers': ['<%= @log_handler %>'], 'handlers': ['<%= @log_handlers_real.join("', '") %>'],
# 'level': 'DEBUG', # 'level': 'DEBUG',
'level': '<%= @log_level %>', 'level': '<%= @log_level %>',
'propagate': False, 'propagate': False,
}, },
'openstack_dashboard': { 'openstack_dashboard': {
# 'handlers': ['console'], # 'handlers': ['console'],
'handlers': ['<%= @log_handler %>'], 'handlers': ['<%= @log_handlers_real.join("', '") %>'],
# 'level': 'DEBUG', # 'level': 'DEBUG',
'level': '<%= @log_level %>', 'level': '<%= @log_level %>',
'propagate': False, 'propagate': False,
}, },
'novaclient': { 'novaclient': {
# 'handlers': ['console'], # 'handlers': ['console'],
'handlers': ['<%= @log_handler %>'], 'handlers': ['<%= @log_handlers_real.join("', '") %>'],
# 'level': 'DEBUG', # 'level': 'DEBUG',
'level': '<%= @log_level %>', 'level': '<%= @log_level %>',
'propagate': False, 'propagate': False,
}, },
'cinderclient': { 'cinderclient': {
# 'handlers': ['console'], # 'handlers': ['console'],
'handlers': ['<%= @log_handler %>'], 'handlers': ['<%= @log_handlers_real.join("', '") %>'],
# 'level': 'DEBUG', # 'level': 'DEBUG',
'level': '<%= @log_level %>', 'level': '<%= @log_level %>',
'propagate': False, 'propagate': False,
}, },
'keystoneclient': { 'keystoneclient': {
# 'handlers': ['console'], # 'handlers': ['console'],
'handlers': ['<%= @log_handler %>'], 'handlers': ['<%= @log_handlers_real.join("', '") %>'],
# 'level': 'DEBUG', # 'level': 'DEBUG',
'level': '<%= @log_level %>', 'level': '<%= @log_level %>',
'propagate': False, 'propagate': False,
}, },
'glanceclient': { 'glanceclient': {
# 'handlers': ['console'], # 'handlers': ['console'],
'handlers': ['<%= @log_handler %>'], 'handlers': ['<%= @log_handlers_real.join("', '") %>'],
# 'level': 'DEBUG', # 'level': 'DEBUG',
'level': '<%= @log_level %>', 'level': '<%= @log_level %>',
'propagate': False, 'propagate': False,
}, },
'neutronclient': { 'neutronclient': {
# 'handlers': ['console'], # 'handlers': ['console'],
'handlers': ['<%= @log_handler %>'], 'handlers': ['<%= @log_handlers_real.join("', '") %>'],
# 'level': 'DEBUG', # 'level': 'DEBUG',
'level': '<%= @log_level %>', 'level': '<%= @log_level %>',
'propagate': False, 'propagate': False,
}, },
'heatclient': { 'heatclient': {
# 'handlers': ['console'], # 'handlers': ['console'],
'handlers': ['<%= @log_handler %>'], 'handlers': ['<%= @log_handlers_real.join("', '") %>'],
# 'level': 'DEBUG', # 'level': 'DEBUG',
'level': '<%= @log_level %>', 'level': '<%= @log_level %>',
'propagate': False, 'propagate': False,
}, },
'troveclient': { 'troveclient': {
# 'handlers': ['console'], # 'handlers': ['console'],
'handlers': ['<%= @log_handler %>'], 'handlers': ['<%= @log_handlers_real.join("', '") %>'],
# 'level': 'DEBUG', # 'level': 'DEBUG',
'level': '<%= @log_level %>', 'level': '<%= @log_level %>',
'propagate': False, 'propagate': False,
}, },
'swiftclient': { 'swiftclient': {
# 'handlers': ['console'], # 'handlers': ['console'],
'handlers': ['<%= @log_handler %>'], 'handlers': ['<%= @log_handlers_real.join("', '") %>'],
# 'level': 'DEBUG', # 'level': 'DEBUG',
'level': '<%= @log_level %>', 'level': '<%= @log_level %>',
'propagate': False, 'propagate': False,
}, },
'openstack_auth': { 'openstack_auth': {
# 'handlers': ['console'], # 'handlers': ['console'],
'handlers': ['<%= @log_handler %>'], 'handlers': ['<%= @log_handlers_real.join("', '") %>'],
# 'level': 'DEBUG', # 'level': 'DEBUG',
'level': '<%= @log_level %>', 'level': '<%= @log_level %>',
'propagate': False, 'propagate': False,
}, },
'nose.plugins.manager': { 'nose.plugins.manager': {
# 'handlers': ['console'], # 'handlers': ['console'],
'handlers': ['<%= @log_handler %>'], 'handlers': ['<%= @log_handlers_real.join("', '") %>'],
# 'level': 'DEBUG', # 'level': 'DEBUG',
'level': '<%= @log_level %>', 'level': '<%= @log_level %>',
'propagate': False, 'propagate': False,
}, },
'django': { 'django': {
# 'handlers': ['console'], # 'handlers': ['console'],
'handlers': ['<%= @log_handler %>'], 'handlers': ['<%= @log_handlers_real.join("', '") %>'],
# 'level': 'DEBUG', # 'level': 'DEBUG',
'level': '<%= @log_level %>', 'level': '<%= @log_level %>',
'propagate': False, 'propagate': False,