aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-07-18 15:42:43 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-07-18 15:42:43 +0100
commitd84d5fb931850955a9eb0f4a0edd0b6a00dc8ed9 (patch)
tree79b6b33a035ae4024ea249d6618525532075b600
parenteb76e0b20da5ac71f304a930df5c0f9fcf56652b (diff)
* Fixed up log rotation.
* Added a couple of exception catches.
-rwxr-xr-xbin/mauveserver12
-rw-r--r--lib/mauve/configuration.rb2
-rw-r--r--lib/mauve/mauve_thread.rb8
3 files changed, 17 insertions, 5 deletions
diff --git a/bin/mauveserver b/bin/mauveserver
index 9d1cf53..24eb168 100755
--- a/bin/mauveserver
+++ b/bin/mauveserver
@@ -117,8 +117,16 @@ end
new.formatter = old.formatter
new.level = old.level
- Mauve::Server.instance.logger.outputters << new
- Mauve::Server.instance.logger.outputters.delete(old)
+ Mauve::Server.instance.logger.info "Closing #{old.filename}."
+
+ #
+ # Delete the outputter from each logger.
+ #
+ Log4r::Logger.each_logger do |l|
+ l.outputters << new
+ l.outputters.delete(old)
+ end
+
old.close
Mauve::Server.instance.logger.info "Opened #{new.filename}."
diff --git a/lib/mauve/configuration.rb b/lib/mauve/configuration.rb
index baf6ad1..0d3e520 100644
--- a/lib/mauve/configuration.rb
+++ b/lib/mauve/configuration.rb
@@ -88,6 +88,8 @@ module Mauve
require "log4r/outputter/#{@outputter.downcase}"
end
+ @outputter_name = "Mauve-"+5.times.collect{rand(36).to_s(36)}.join
+
@args = {}
end
diff --git a/lib/mauve/mauve_thread.rb b/lib/mauve/mauve_thread.rb
index 1aa8619..4a2787d 100644
--- a/lib/mauve/mauve_thread.rb
+++ b/lib/mauve/mauve_thread.rb
@@ -53,13 +53,15 @@ module Mauve
@frozen = true
- 20.times { Kernel.sleep 0.1 ; break if @thread.stop? }
+ if @thread.is_a?(Thread)
+ 20.times { Kernel.sleep 0.1 ; break if @thread.stop? }
- logger.debug("Thread has not frozen!") unless @thread.stop?
+ logger.debug("Thread has not frozen!") unless @thread.stop?
+ end
end
def frozen?
- defined? @frozen and @frozen and @thread.stop?
+ defined? @frozen and @frozen and @thread.is_a?(Thread) and @thread.stop?
end
def thaw