Skip to content

Instantly share code, notes, and snippets.

@jbarciauskas
Created December 16, 2011 19:17
Show Gist options
  • Save jbarciauskas/1487497 to your computer and use it in GitHub Desktop.
Save jbarciauskas/1487497 to your computer and use it in GitHub Desktop.
logstash-303
[~/src/logstash]> git diff
diff --git a/lib/logstash/agent.rb b/lib/logstash/agent.rb
index 750aba6..23fff2a 100644
--- a/lib/logstash/agent.rb
+++ b/lib/logstash/agent.rb
@@ -15,6 +15,8 @@ require "optparse"
require "thread"
require "uri"
+include_class Java::java.lang.Error
+
# TODO(sissel): only enable this if we are in debug mode.
# JRuby.objectspace=true
@@ -648,7 +650,11 @@ class LogStash::Agent
begin
input.run(queue)
done = true
- rescue => e
+ rescue Error => e
+ @logger.error("Input thread unrecoverable exception", :plugin => input,
+ :exception => e, :backtrace => e.backtrace)
+ exit 1
+ rescue Exception => e
@logger.warn("Input thread exception", :plugin => input,
:exception => e, :backtrace => e.backtrace)
@logger.error("Restarting input due to exception", :plugin => input)
@@ -691,6 +697,10 @@ class LogStash::Agent
@logger.debug("Sending event", :target => output)
output.handle(event)
end
+ rescue Error => e
+ @logger.error("Output thread unrecoverable exception", :plugin => output,
+ :exception => e, :backtrace => e.backtrace)
+ exit 1
rescue Exception => e
@logger.warn("Output thread exception", :plugin => output,
:exception => e, :backtrace => e.backtrace)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment