Add watch_log_file option

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

Change-Id: I560b24f023cb554b9087ccb2ae1dc603101bb160
Closes-Bug: #1943212
This commit is contained in:
ZhongShengping 2021-09-14 16:02:09 +08:00
parent 2c01d34eed
commit 2a21b03b2a
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.
@ -106,6 +110,7 @@ class murano::logging(
$log_facility = $::os_service_default,
$log_dir = '/var/log/murano',
$log_file = $::os_service_default,
$watch_log_file = $::os_service_default,
$logging_context_format_string = $::os_service_default,
$logging_default_format_string = $::os_service_default,
$logging_debug_format_suffix = $::os_service_default,
@ -129,6 +134,7 @@ class murano::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 ``murano::logging::watch_log_file`` parameter has been added.

View File

@ -17,6 +17,7 @@ describe 'murano::logging' do
:log_facility => 'LOG_LOCAL0',
:log_dir => '/tmp/murano',
:log_file => '/tmp/murano/murano.log',
:watch_log_file => true,
: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',
@ -64,13 +65,14 @@ describe 'murano::logging' do
context 'with defaults' do
it { is_expected.to contain_oslo__log('murano_config').with(
:use_syslog => '<SERVICE DEFAULT>',
:use_json => '<SERVICE DEFAULT>',
:use_journal => '<SERVICE DEFAULT>',
:use_stderr => '<SERVICE DEFAULT>',
:log_dir => '/var/log/murano',
: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/murano',
:log_file => '<SERVICE DEFAULT>',
:watch_log_file => '<SERVICE DEFAULT>',
:debug => '<SERVICE DEFAULT>',
)}
end
@ -96,6 +98,7 @@ describe 'murano::logging' do
:syslog_log_facility => 'LOG_LOCAL0',
:log_dir => '/tmp/murano',
:log_file => '/tmp/murano/murano.log',
:watch_log_file => true,
:debug => true,
)}
end