lib/rabbit/logger/stderr.rb in rabbit-2.1.3 vs lib/rabbit/logger/stderr.rb in rabbit-2.1.4
- old
+ new
@@ -11,10 +11,13 @@
def do_log(severity, prog_name, message)
begin
message = message.encode("locale")
rescue EncodingError
format = _("can't convert to current locale from UTF-8: %s")
- $stderr.puts(format % message.encode(format.encoding))
+ sanitized_message = message.encode(format.encoding,
+ :invalid => :replace,
+ :undef => :replace)
+ $stderr.puts(format % sanitized_message)
end
$stderr.puts(format_severity(severity))
$stderr.print("[#{prog_name}]: ") if prog_name
$stderr.puts(message)
exit if severity >= Severity::FATAL