scout_agent 3.2.0 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ == 3.2.1
2
+
3
+ * Fixed a bug where log shifting failures could cause the agent to crash
4
+
1
5
  == 3.2.0
2
6
 
3
7
  * Fixed a bug where the API would require the wrong version of the JSON library
data/lib/scout_agent.rb CHANGED
@@ -61,6 +61,7 @@ module ScoutAgent
61
61
  # do nothing: we will stick with the default
62
62
  end
63
63
  wire_tap.progname = process_name
64
+ wire_tap.quiet = true
64
65
  wire_tap.tap = $stdout unless skip_stdout or Plan.run_as_daemon?
65
66
  wire_tap
66
67
  end
@@ -91,7 +92,7 @@ module ScoutAgent
91
92
  end
92
93
 
93
94
  # The version of this agent.
94
- VERSION = "3.2.0".freeze
95
+ VERSION = "3.2.1".freeze
95
96
  # A Pathname reference to the agent code directory, used in dynamic loading.
96
97
  LIB_DIR = Pathname.new(File.dirname(__FILE__)) + agent_name
97
98
  end
@@ -148,6 +148,7 @@ module ScoutAgent
148
148
  end
149
149
  @shift_age = options[:shift_age] || 7
150
150
  @shift_size = options[:shift_size] || 1048576
151
+ @quiet = false
151
152
  @lock = Mutex.new
152
153
  end
153
154
 
@@ -155,6 +156,17 @@ module ScoutAgent
155
156
  attr_reader :dev
156
157
  # A base name for files created by this device.
157
158
  attr_reader :filename
159
+ #
160
+ # Set this to +true+ to silence shifting failures. This keeps your
161
+ # logging code from throwning Exceptions due to external forces beyond the
162
+ # control of this object, but it may result in some data loss.
163
+ #
164
+ attr_writer :quiet
165
+
166
+ # Returns +true+ if ShiftingError's will not be thrown.
167
+ def quiet?
168
+ @quiet
169
+ end
158
170
 
159
171
  #
160
172
  # Writes +message+ to +dev+ in a multi-Thread and multi-Process safe
@@ -170,7 +182,9 @@ module ScoutAgent
170
182
  begin
171
183
  shift_log if @filename and @dev.respond_to?(:stat)
172
184
  rescue Exception => error # shifting failed for whatever reason
173
- raise ShiftingError, "Shifting failed: #{error.message}"
185
+ unless @quiet
186
+ raise ShiftingError, "Shifting failed: #{error.message}"
187
+ end
174
188
  end
175
189
  begin
176
190
  #
@@ -374,6 +388,16 @@ module ScoutAgent
374
388
  # The Process name used in messages logged by this instance.
375
389
  attr_accessor :progname
376
390
 
391
+ # A simple wrapper for LogDevice#quiet?().
392
+ def quiet?
393
+ @logdev.quiet?
394
+ end
395
+
396
+ # A simple wrapper for LogDevice#quiet=().
397
+ def quiet=(boolean)
398
+ @logdev.quiet = boolean
399
+ end
400
+
377
401
  #
378
402
  # Sets a new timestamp format on the Formatter used to format messages for
379
403
  # this instance. +datetime_format+ should be a strftime() pattern String.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Edward Gray II
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2009-05-22 00:00:00 -05:00
15
+ date: 2009-05-26 00:00:00 -05:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency