Expose use_json logging option

It enables JSON-formatted logging from oslo.log.

Change-Id: If00976cbea705fb67be3abb12aa70d4a41ea83c3
This commit is contained in:
Juan Antonio Osorio Robles 2017-11-24 16:01:10 +02:00
parent 2d4805c85b
commit 439fbdb76a
3 changed files with 13 additions and 0 deletions

View File

@ -48,6 +48,10 @@
# This option is ignored if log_config_append is set.
# Defaults to $::os_service_default
#
# [*use_json*]
# (Optional) Use JSON format for logging (boolean value).
# Defaults to $::os_service_default
#
# [*use_stderr*]
# (Optional) Log output to standard error.
# This option is ignored if log_config_append is set.
@ -115,6 +119,7 @@ define oslo::log(
$watch_log_file = $::os_service_default,
$use_syslog = $::os_service_default,
$use_journal = $::os_service_default,
$use_json = $::os_service_default,
$syslog_log_facility = $::os_service_default,
$use_stderr = $::os_service_default,
$logging_context_format_string = $::os_service_default,
@ -153,6 +158,7 @@ define oslo::log(
'DEFAULT/watch_log_file' => { value => $watch_log_file },
'DEFAULT/use_syslog' => { value => $use_syslog },
'DEFAULT/use_journal' => { value => $use_journal },
'DEFAULT/use_json' => { value => $use_json },
'DEFAULT/syslog_log_facility' => { value => $syslog_log_facility },
'DEFAULT/use_stderr' => { value => $use_stderr },
'DEFAULT/logging_context_format_string' => { value => $logging_context_format_string },

View File

@ -0,0 +1,4 @@
---
features:
- |
Expose use_json logging parameter, which enables JSON formatted logging.

View File

@ -16,6 +16,7 @@ describe 'oslo::log' do
is_expected.to contain_keystone_config('DEFAULT/watch_log_file').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('DEFAULT/use_syslog').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('DEFAULT/use_journal').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('DEFAULT/use_json').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('DEFAULT/syslog_log_facility').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('DEFAULT/use_stderr').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('DEFAULT/logging_context_format_string').with_value('<SERVICE DEFAULT>')
@ -41,6 +42,7 @@ describe 'oslo::log' do
:watch_log_file => true,
:use_syslog => true,
:use_journal => true,
:use_json => true,
:syslog_log_facility => 'LOG_USER',
:use_stderr => true,
:logging_context_format_string =>
@ -68,6 +70,7 @@ describe 'oslo::log' do
is_expected.to contain_keystone_config('DEFAULT/watch_log_file').with_value(true)
is_expected.to contain_keystone_config('DEFAULT/use_syslog').with_value(true)
is_expected.to contain_keystone_config('DEFAULT/use_journal').with_value(true)
is_expected.to contain_keystone_config('DEFAULT/use_json').with_value(true)
is_expected.to contain_keystone_config('DEFAULT/syslog_log_facility').with_value('LOG_USER')
is_expected.to contain_keystone_config('DEFAULT/use_stderr').with_value(true)
is_expected.to contain_keystone_config('DEFAULT/logging_context_format_string').with_value(