11.6 Appears to Break Logging to Syslog?


#1

Hi Folks,

Receiving the following error when bootstrapping with 11.6

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/monologger.rb:69:in
exist?': can't convert Syslog::Logger into String (TypeError) from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/monologger.rb:69:inopen_logfile’
[…]
from
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/bin/chef-client:26:in
<top (required)>' from /usr/bin/chef-client:23:inload’
from /usr/bin/chef-client:23:in `’

I believe this was introduced by
https://github.com/opscode/chef/commit/43d01dcc6bfc44571d72a2e9bc4f32524f547ea7-
adding MonoLogger to resolve
http://tickets.opscode.com/browse/CHEF-3935

This breaks the solution at
http://lists.opscode.com/sympa/arc/chef/2013-01/msg00037.html, and
presumably also https://github.com/higanworks-cookbooks/chef-client_syslog,
http://tickets.opscode.com/browse/CHEF-273 ,
http://tickets.opscode.com/browse/COOK-2326 , etc.

Recommend adding a new attribute rather than continuing to overload
log_location.

Anyone have a workaround?

Best,
Alastair


#2

On Fri, Aug 23, 2013 at 8:47 PM, Alastair Firth alfirth@gmail.com wrote:

I believe this was introduced by
https://github.com/opscode/chef/commit/43d01dcc6bfc44571d72a2e9bc4f32524f547ea7

This breaks the solution at
http://lists.opscode.com/sympa/arc/chef/2013-01/msg00037.html, and
presumably also https://github.com/higanworks-cookbooks/chef-client_syslog ,
http://tickets.opscode.com/browse/CHEF-273 ,
http://tickets.opscode.com/browse/COOK-2326 , etc.

Recommend adding a new attribute rather than continuing to overload
log_location.

Anyone have a workaround?

Hi,

You need to make sure whatever log replacement instance you give as an
argument to log_location implements a #write(message) and a #close
method, otherwise chef will think the argument is a file path.

We are successfully using this implementation (slightly simplified):
https://github.com/ngmoco/syslog_logger/blob/master/lib/syslog-logger.rb.
We just had to add an empty #close method and a dummy #write(message)
method, that calls #info(message).


Eric-Olivier Lamey