lib/logstash/outputs/charrington/create_redshift_table.rb in logstash-output-charrington-0.3.3 vs lib/logstash/outputs/charrington/create_redshift_table.rb in logstash-output-charrington-0.3.4
- old
+ new
@@ -4,10 +4,11 @@
class CreateRedshiftTable
# This service will create a table dynamically based on the JSON structure.
# This is potentially called from Insert when an insert fails.
include Service
+ include LogStash::Util::Loggable
attr_reader :connection, :event, :table_name, :columns, :schema
attr_accessor :column_types
Error = Class.new(StandardError)
CreateFailed = Class.new(Error)
@@ -76,9 +77,10 @@
def execute(sql)
statement = connection.prepareStatement( sql.gsub(/\s+/, " ").strip )
statement.execute()
rescue Java::JavaSql::SQLException => e
puts "Redshift SQLException: #{e.message}"
+ self.logger.info "Redshift SQLException: #{e.message}"
ensure
statement.close unless statement.nil?
end
end
end