title: How to log error messages in chef recipe
body: <p>How to log the error messages in a recipe.</p>
  
  <p>For EX: My recipe here is</p>
  
  <pre><code>#
  # Cookbook:: mkdir
  # Recipe:: default
  #
  # Copyright:: 2018, The Authors, All Rights Reserved.
  
  bash 'extract_module' do
  code &lt;&lt;-EOH
  mkdir -p /tmp/#{node['main']['directory']}
  EOH
  Chef::Log.info "Directory Created"
  #puts "Directory created"
  
  end
  </code></pre>
  
  <p>Where is the log file actually created ??? --> Chef::Log.info "Directory Created"</p>
  
  <p>How can i control my recipe to stop if</p>
  
  <pre><code>mkdir -p /tmp/#{node['main']['directory']}
  </code></pre>
  
  <p>actually fails??</p>
  
  <p>Thank you</p>