Add watch_log_file option

Add support for Using logging handler designed to watch file system.

Change-Id: Ib2769d2765f8dd6f8b9e26538ceb8d671d0f0e64
Closes-Bug: #1943212
This commit is contained in:
ZhongShengping 2021-09-14 16:02:09 +08:00
parent bca357635d
commit c7f078ec68
3 changed files with 20 additions and 7 deletions

View File

@ -37,6 +37,10 @@
# (Optional) File where logs should be stored.
# Defaults to $::os_service_default
#
# [*watch_log_file*]
# (Optional) Uses logging handler designed to watch file system (boolean value).
# Defaults to $::os_service_default
#
# [*logging_context_format_string*]
# (Optional) Format string to use for log messages with context.
# Defaults to $::os_service_default
@ -109,6 +113,7 @@ class magnum::logging(
$log_facility = $::os_service_default,
$log_dir = '/var/log/magnum',
$log_file = $::os_service_default,
$watch_log_file = $::os_service_default,
$debug = $::os_service_default,
$logging_context_format_string = $::os_service_default,
$logging_default_format_string = $::os_service_default,
@ -133,6 +138,7 @@ class magnum::logging(
use_stderr => $use_stderr,
log_dir => $log_dir,
log_file => $log_file,
watch_log_file => $watch_log_file,
syslog_log_facility => $log_facility,
logging_context_format_string => $logging_context_format_string,
logging_default_format_string => $logging_default_format_string,

View File

@ -0,0 +1,4 @@
---
features:
- |
The new ``magnum::logging::watch_log_file`` parameter has been added.

View File

@ -30,6 +30,7 @@ describe 'magnum::logging' do
:log_facility => 'LOG_FOO',
:log_dir => '/var/log',
:log_file => '/var/log/magnum/magnum.log',
:watch_log_file => true,
:debug => true,
}
end
@ -59,13 +60,14 @@ describe 'magnum::logging' do
shared_examples 'basic default logging settings' do
it 'configures magnum logging settings with default values' do
is_expected.to contain_oslo__log('magnum_config').with(
:use_syslog => '<SERVICE DEFAULT>',
:use_json => '<SERVICE DEFAULT>',
:use_journal => '<SERVICE DEFAULT>',
:use_stderr => '<SERVICE DEFAULT>',
:log_dir => '/var/log/magnum',
:log_file => '<SERVICE DEFAULT>',
:debug => '<SERVICE DEFAULT>',
:use_syslog => '<SERVICE DEFAULT>',
:use_json => '<SERVICE DEFAULT>',
:use_journal => '<SERVICE DEFAULT>',
:use_stderr => '<SERVICE DEFAULT>',
:log_dir => '/var/log/magnum',
:log_file => '<SERVICE DEFAULT>',
:watch_log_file => '<SERVICE DEFAULT>',
:debug => '<SERVICE DEFAULT>',
)
end
end
@ -80,6 +82,7 @@ describe 'magnum::logging' do
:syslog_log_facility => 'LOG_FOO',
:log_dir => '/var/log',
:log_file => '/var/log/magnum/magnum.log',
:watch_log_file => true,
:debug => true,
)
end