Drop hard-coded log_file

Because the service config file is shared among multiple services,
we should not set the option without any specific reason. In case
the option is not set (and no --log-file argument is passed) then
log file name is determined according to the process name, and each
service creates its own file.

Change-Id: Iadaf4eceb0a052bef437603d6cbe6422f4ee9b13
This commit is contained in:
Takashi Kajinami 2024-09-22 12:33:37 +09:00
parent 3f4c77b858
commit e4862af5dc
2 changed files with 3 additions and 3 deletions

View File

@ -35,7 +35,7 @@
# #
# [*log_file*] # [*log_file*]
# (Optional) File where logs should be stored. # (Optional) File where logs should be stored.
# Defaults to '/var/log/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}.log' # Defaults to $facts['os_service_default']
# #
# [*logging_context_format_string*] # [*logging_context_format_string*]
# (Optional) Format string to use for log messages with context. # (Optional) Format string to use for log messages with context.
@ -108,7 +108,7 @@ class {{cookiecutter.project_name}}::logging(
$use_stderr = $facts['os_service_default'], $use_stderr = $facts['os_service_default'],
$syslog_log_facility = $facts['os_service_default'], $syslog_log_facility = $facts['os_service_default'],
$log_dir = '/var/log/{{cookiecutter.project_name}}', $log_dir = '/var/log/{{cookiecutter.project_name}}',
$log_file = '/var/log/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}.log', $log_file = $facts['os_service_default'],
$debug = $facts['os_service_default'], $debug = $facts['os_service_default'],
$logging_context_format_string = $facts['os_service_default'], $logging_context_format_string = $facts['os_service_default'],
$logging_default_format_string = $facts['os_service_default'], $logging_default_format_string = $facts['os_service_default'],

View File

@ -66,7 +66,7 @@ describe '{{cookiecutter.project_name}}::logging' do
:use_stderr => '<SERVICE DEFAULT>', :use_stderr => '<SERVICE DEFAULT>',
:syslog_log_facility => '<SERVICE DEFAULT>', :syslog_log_facility => '<SERVICE DEFAULT>',
:log_dir => '/var/log/{{cookiecutter.project_name}}', :log_dir => '/var/log/{{cookiecutter.project_name}}',
:log_file => '/var/log/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}.log', :log_file => '<SERVICE DEFAULT>',
:debug => '<SERVICE DEFAULT>', :debug => '<SERVICE DEFAULT>',
)} )}
end end