- From: Daniel DeLeo <
>
- To:
- Subject: [chef] Re: Logging and references questions
- Date: Wed, 16 Apr 2014 11:25:48 -0700
On Wednesday, April 16, 2014 at 4:16 AM, Christian Fröstl wrote:
>
Hi there,
>
>
I have problems with understanding the logging procedure with chef.
>
>
I can log some information by using the following syntax:
>
log „foo" do
>
level :debug
>
end
>
>
>
Now I find in some cookbooks the following spelling:
>
Chef::Log.debug("Node has Chef Server Recipe?
>
#{node.recipe?("chef-server")}“)
This blog post is a pretty awesome and thorough description of how
chef-client has two stages: compile and converge:
http://erik.hollensbe.org/2013/03/16/the-chef-resource-run-queue/
`Chef::Log.debug` is a method call that writes a string to the logger, which
then writes it do some device (or not, depending on your log level, etc.).
The log resource puts an item in the resource_collection queue. In the
converge phase chef iterates over this queue, and will eventually run this
code
https://github.com/opscode/chef/blob/master/lib/chef/provider/log.rb
which you can see is more or less the same as Chef::Log.debug(). So the
primary difference is the timing.
>
>
What does Chef::Log.debug exactly do?
>
I do not get any output if i run the chef-client in normal or in debug
>
mode. What is the STDOUT from Chef::Log?
Did you configure chef to log to a file? Check your client.rb.
>
>
By the way, I am not really sure what Chef:: represents. Where can I find
>
the class or module Chef?
>
In some scripts I the other references like Chef::Client::SANE_PATHS. Where
>
can I find the content of such references?
>
>
Sorry if the questions are a litte bit stupid, but I am right new in
>
writing Code.
One easy way to spelunk the code is to clone the git repo from here:
https://github.com/opscode/chef and use `git grep` to search the codebase.
>
>
>
Thank you very much,
>
>
Christian
HTH,
--
Daniel DeLeo
Archive powered by MHonArc 2.6.16.