Does the logging show up in the log files? I had a very similar issue recently, and found that the logging did not show up on stdout, but was logged in the Chef log file.
Kevin Keane
The NetTech
http://www.4nettech.com
Our values: Privacy, Liberty, Justice
See https://www.4nettech.com/corp/the-nettech-values.html
-----Original message-----
From: Mark Selby < >
Sent: Friday 6th March 2015 12:26
To: Lamont Granquist < >
Cc:
Subject: [chef] Re: Logging within a ruby_blockI can confirm that running chef-client with -l info or -l debug still does not produce the requested logs. I am pretty sure that I have to do somethint special to get logging inside a ruby_block to workOn Fri, Mar 6, 2015 at 12:10 PM, Lamont Granquist < " target="_blank" title="This external link will open in a new window"> > wrote::info and :debug are suppressed by default, if you do 'chef-client -l info' do you see your log message?
On 3/6/15 12:07 PM, Mark Selby wrote:
I have searched the interwebs and have not found the answer that I am looking for so hopefully someone where has solved my problem
I want to log stuff using chef log levels when inside a ruby_block. The BELOW DOES NOT WORK
ruby_block "ruby_block_thing" doblock dofoo = my_methodif foo.sucess?Chef::Log.info("sucessfully ran my_method")Chef::Log.debug("my_method said #{foo.response}")endendaction :runend
Any know the "correct" way to log stuff within a ruby block. I am hoping that using puts is not the best answer.
As you can see here I want to output different thing based on different log level.
Archive powered by MHonArc 2.6.16.