Skip to content

Commit

Permalink
Merge pull request #462 from lurkermike/master
Browse files Browse the repository at this point in the history
(#12402) split log messages into individual lines before sending to syslog
  • Loading branch information
slippycheeze committed Feb 8, 2012
2 parents 9859517 + b89da8c commit 76d05c2
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/puppet/util/log/destinations.rb
Expand Up @@ -30,12 +30,16 @@ def handle(msg)
# cannot log a message with a '%' in it. So, we get rid
# of them.
if msg.source == "Puppet"
@syslog.send(msg.level, msg.to_s.gsub("%", '%%'))
msg.to_s.split("\n").each do |line|
@syslog.send(msg.level, line.gsub("%", '%%'))
end
else
@syslog.send(msg.level, "(%s) %s" % [msg.source.to_s.gsub("%", ""),
msg.to_s.gsub("%", '%%')
]
)
msg.to_s.split("\n").each do |line|
@syslog.send(msg.level, "(%s) %s" % [msg.source.to_s.gsub("%", ""),
line.gsub("%", '%%')
]
)
end
end
end
end
Expand Down

0 comments on commit 76d05c2

Please sign in to comment.