diff --git a/lib/oink/active_record_instantiation_reporter.rb b/lib/oink/active_record_instantiation_reporter.rb index 4ab86f7..d9774c1 100644 --- a/lib/oink/active_record_instantiation_reporter.rb +++ b/lib/oink/active_record_instantiation_reporter.rb @@ -18,7 +18,12 @@ def print(output) line = line.strip # Skip this line since we're only interested in the Hodel 3000 compliant lines - next unless line =~ HODEL_LOG_FORMAT_REGEX + begin + next unless line =~ HODEL_LOG_FORMAT_REGEX + rescue => e + output.puts "\nSkipping malformed line" if @format == :verbose and e.message =~ /invalid byte sequence/ + next + end if line =~ /rails\[(\d+)\]/ pid = $1 @@ -65,4 +70,4 @@ def print(output) end -end \ No newline at end of file +end diff --git a/lib/oink/memory_usage_reporter.rb b/lib/oink/memory_usage_reporter.rb index 7461c97..9205d8c 100644 --- a/lib/oink/memory_usage_reporter.rb +++ b/lib/oink/memory_usage_reporter.rb @@ -16,8 +16,14 @@ def print(output) input.each_line do |line| line = line.strip - # Skip this line since we're only interested in the Hodel 3000 compliant lines - next unless line =~ HODEL_LOG_FORMAT_REGEX + # Skip this line since we're only interested in the Hodel 3000 compliant lines + # Also skip lines that have the wrong character encoding + begin + next unless line =~ HODEL_LOG_FORMAT_REGEX + rescue => e + output.puts "\nSkipping malformed line" if @format == :verbose and e.message =~ /invalid byte sequence/ + next + end if line =~ /rails\[(\d+)\]/ pid = $1 @@ -69,4 +75,4 @@ def print(output) end -end \ No newline at end of file +end