diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-10-09 17:41:36 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-10-09 17:41:36 +0000 |
commit | 133c17fa6665256cafdcd1cf76d2ae50233c44f4 (patch) | |
tree | 1288ceef2c13826fea395a518cdb4fc806ca8ad6 /lib/puppet | |
parent | c3cc16274d2a2cc0b394bb7ec7fbb8b45491abcc (diff) | |
download | puppet-133c17fa6665256cafdcd1cf76d2ae50233c44f4.tar.gz puppet-133c17fa6665256cafdcd1cf76d2ae50233c44f4.tar.xz puppet-133c17fa6665256cafdcd1cf76d2ae50233c44f4.zip |
Fixing #305 -- logs now reopen when Puppet restarts, and there is also now an autoflush mechanism available so logs will flush to disk immediately. I also now trap USR2 and reopen logs when it is sent, so if you just want to reopen logs you do not have to restart the whole process.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1750 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/log.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/puppet/log.rb b/lib/puppet/log.rb index c8d92e649..c76dd945c 100644 --- a/lib/puppet/log.rb +++ b/lib/puppet/log.rb @@ -237,11 +237,15 @@ module Puppet file = File.open(path, File::WRONLY|File::CREAT|File::APPEND) @file = file + + @autoflush = Puppet[:autoflush] end def handle(msg) @file.puts("%s %s (%s): %s" % [msg.time, msg.source, msg.level, msg.to_s]) + + @file.flush if @autoflush end end @@ -411,6 +415,7 @@ module Puppet # Reopen all of our logs. def Log.reopen + Puppet.notice "Reopening log files" types = @destinations.keys @destinations.each { |type, dest| if dest.respond_to?(:close) |