Please review pull request #496: (#9595) Flush file log destination by default opened by (joshcooper)
Description:
Previously, puppet did not call IO#flush after writing each log
message to its log file destination. As a result, if the agent
terminated unexpectedly, any data buffered in ruby, but not yet
flushed would be lost.
This commit changes the default value of autoflush to be true, which
will cause ruby to flush its buffer. Since this property is only used
by the file log destination, and the documentation for the property
says, 'Whether log files should always flush to disk.', it seems safe
to change the default value.
- Opened: Tue Feb 14 19:21:36 UTC 2012
- Based on: puppetlabs:2.7.x (53380b98a2899ef94b1f50027d5fb6b5d04e9ba4)
- Requested merge: joshcooper:ticket/2.7.x/9595-flush-log-destination (c402e7e5c88f9d8322b35970fda3b3b98a664886)
Diff follows:
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb
index 71d04df..1a2811e 100644
--- a/lib/puppet/defaults.rb
+++ b/lib/puppet/defaults.rb
@@ -15,7 +15,7 @@ module Puppet
setdefaults(:main,
:trace => [false, "Whether to print stack traces on some errors"],
:autoflush => {
- :default => false,
+ :default => true,
:desc => "Whether log files should always flush to disk.",
:hook => proc { |value| Log.autoflush = value }
},
diff --git a/spec/unit/util/log/destinations_spec.rb b/spec/unit/util/log/destinations_spec.rb
index 3cb8e24..7b67250 100755
--- a/spec/unit/util/log/destinations_spec.rb
+++ b/spec/unit/util/log/destinations_spec.rb
@@ -29,8 +29,8 @@
@class = Puppet::Util::Log.desttypes[:file]
end
- it "should default to autoflush false" do
- @class.new('/tmp/log').autoflush.should == false
+ it "should default to autoflush true" do
+ @class.new('/tmp/log').autoflush.should == true
end
describe "when matching" do
-- You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
