Chef client 12 - setting logging level


#1

Hello,

We are running chef client 12.0.3 on a CentOS 7 server.

We have noticed that the ‘client.rb’ file included no logging entries,
and so nothing was logged of the chef-client runs. By setting the
’log_file’ attribute, we now have a log file created (and the relevant
entry in the client.rb file).

However, it seems that the logging level is defaulting to ‘warn’, and we
cannot see how to change this to ‘info’.

From https://github.com/opscode-cookbooks/chef-client it says that the
’log_level’ attribute has been deprecated/replaced: ‘Not set anymore,
use the default log level and output formatting from Chef 11.’

Does this mean that we cannot change the log level? If I have
misunderstood, then how do we alter the log level?

Thanks,

John.

John Horne Tel: +44 (0)1752 587287
Plymouth University, UK


#2

You want to set node['chef_client']['config’][‘log_level’] = ‘info’ if you are using the cookbook - the ‘config’ section of attributes are directly dropped into the /etc/chef/client.rb file. The https://github.com/opscode-cookbooks/chef-client#usage section shows some examples of this.

-T

On Jan 28, 2015, at 1:35 PM, John Horne john.horne@plymouth.ac.uk wrote:

Hello,

We are running chef client 12.0.3 on a CentOS 7 server.

We have noticed that the ‘client.rb’ file included no logging entries,
and so nothing was logged of the chef-client runs. By setting the
’log_file’ attribute, we now have a log file created (and the relevant
entry in the client.rb file).

However, it seems that the logging level is defaulting to ‘warn’, and we
cannot see how to change this to ‘info’.

From https://github.com/opscode-cookbooks/chef-client it says that the
’log_level’ attribute has been deprecated/replaced: ‘Not set anymore,
use the default log level and output formatting from Chef 11.’

Does this mean that we cannot change the log level? If I have
misunderstood, then how do we alter the log level?

Thanks,

John.

John Horne Tel: +44 (0)1752 587287
Plymouth University, UK


#3

On Wed, 2015-01-28 at 15:31 -0800, Tyler Ball wrote:

You want to set node['chef_client']['config’][‘log_level’] = ‘info’
if you are using the cookbook - the ‘config’ section of attributes are
directly dropped into the /etc/chef/client.rb file. The
https://github.com/opscode-cookbooks/chef-client#usage section shows
some examples of this.

Thanks for this. I admit I did not try it initially because the doc
seemed to simply indicate it was not set. It works fine though.

John.

John Horne Tel: +44 (0)1752 587287
Plymouth University, UK