Browse Source

Expose use_json logging option

It enables JSON-formatted logging from oslo.log.

Change-Id: If00976cbea705fb67be3abb12aa70d4a41ea83c3
changes/26/522826/1
Juan Antonio Osorio Robles 5 years ago
parent
commit
439fbdb76a
  1. 6
      manifests/log.pp
  2. 4
      releasenotes/notes/log-json-70816c646023e567.yaml
  3. 3
      spec/defines/oslo_log_spec.rb

6
manifests/log.pp

@ -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 },

4
releasenotes/notes/log-json-70816c646023e567.yaml

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

3
spec/defines/oslo_log_spec.rb

@ -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(

Loading…
Cancel
Save