HomePhorge

(#12403) Always create a default log destination
6fc9ccd30073Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(#12403) Always create a default log destination

Previously, assumptions were being made that the syslog feature was
always present, which isn't true by default on Windows. As a result,
puppet agent on Windows would not write to a log file unless
explicitly enabled using the --logdest command line option.

This commit adds a new method Puppet::Util::Log.setup_default that
registers a :syslog log destination provided the corresponding feature
is present. Otherwise, it uses a file log destination using the
default puppetdlog setting. This ensures agents without syslog
always have a default log destination.

The commit is fairly straightforward, except for the change to the
application_spec test. I had to stub Puppet.features.stubs(:syslog),
because bug #12540 causes the logdir setting, and all of its
descendent properties, to be corrupted when the value of
Puppet::Util::RunMode#logopts is passed to
Puppet::Settings.set_value, but not when passed to
Puppet::Settings#setdefaults. The latter accepts an older style
array containing the default value and description, but the former
does not. Instead, it munges the default value and description
together, which makes it unsuitable as a file log destination, causing
the test to fail on Windows. Since the actual type of log destination
is not important for the application_spec test, this commit ensures we
always use syslog for the test.

Details

Provenance
Josh Cooper <josh@puppetlabs.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPUbabe7e468d78: Maint: Remove duplicate code from bad merge conflict
Branches
Unknown
Tags
Unknown

Event Timeline

Josh Cooper <josh@puppetlabs.com> committed rPU6fc9ccd30073: (#12403) Always create a default log destination (authored by Josh Cooper <josh@puppetlabs.com>).Feb 14 2012, 9:24 AM