lib/semantic_logger/appender/syslog.rb in semantic_logger-2.9.1 vs lib/semantic_logger/appender/syslog.rb in semantic_logger-2.9.2
- old
+ new
@@ -204,11 +204,13 @@
# Ensure minimum log level is met, and check filter
return false if (level_index > (log.level_index || 0)) || !include_message?(log)
case @protocol
when :syslog
- ::Syslog.log @level_map[log.level], formatter.call(log)
+ # Since the Ruby Syslog API supports sprintf format strings, double up all existing '%'
+ message = formatter.call(log).gsub "%", "%%"
+ ::Syslog.log @level_map[log.level], message
when :tcp
@remote_syslog.retry_on_connection_failure { @remote_syslog.write("#{syslog_packet_formatter(log)}\r\n") }
when :udp
@remote_syslog.send syslog_packet_formatter(log), 0, @host, @port
else
@@ -245,9 +247,8 @@
packet.severity = @level_map[log.level]
packet.tag = @ident
packet.content = default_formatter.call(log)
packet.to_s
end
-
end
end
-end
\ No newline at end of file
+end