# Variable logging levels within a chef recipe

**URL:** <https://discourse.chef.io/t/variable-logging-levels-within-a-chef-recipe/6203>\
**Category:** Chef Infra (archive)\
**Created:** [January 23, 2015, 8:09pm UTC](https://discourse.chef.io/t/variable-logging-levels-within-a-chef-recipe/6203 "2015-01-23T20:09:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![M\_G](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@M\_G](https://discourse.chef.io/u/M_G)\
**Post date:** [January 23, 2015, 8:09pm UTC](https://discourse.chef.io/t/variable-logging-levels-within-a-chef-recipe/6203/1 "2015-01-23T20:09:01Z")

</div>

HI  
In the client.rb the log level is set to info  
When running a recipe, it inherits the above log level  
I have a recipe which does say three things , for example  
package "component"  
file “somefile” do  
end  
service "component service"  
When chef-client is copying the file from chef server to the node, it writes out the content of the file in the chef-client log.  
I would like to suppress logging only for that part of the recipe from within the recipe.  
Is it possible? Any pointers would be appreciated?  
Regards  
mg

---

<div class="post-metadata">

**Author:** ![Justin\_Dossey](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Justin\_Dossey](https://discourse.chef.io/u/Justin_Dossey)\
**Post date:** [January 23, 2015, 8:30pm UTC](https://discourse.chef.io/t/variable-logging-levels-within-a-chef-recipe/6203/2 "2015-01-23T20:30:20Z")

</div>

With a file resource, just pass the attribute:

sensitive true

and Chef won't log the contents.

[https://docs.chef.io/chef/resources.html#id106](https://docs.chef.io/chef/resources.html#id106)

On Fri, Jan 23, 2015 at 12:09 PM, M G [meher03@hotmail.com](mailto:meher03@hotmail.com) wrote:

> HI
> 
> In the client.rb the log level is set to info
> 
> When running a recipe, it inherits the above log level
> 
> I have a recipe which does say three things , for example
> 
> package "component"
> 
> file "somefile" do
> 
> end
> 
> service "component service"
> 
> When chef-client is copying the file from chef server to the node, it  
> writes out the content of the file in the chef-client log.
> 
> I would like to suppress logging only for that part of the recipe from  
> within the recipe.
> 
> Is it possible? Any pointers would be appreciated?
> 
> Regards
> 
> mg

--  
Justin Dossey  
Practice Owner  
New Context Services, Inc

---

<div class="post-metadata">

**Author:** ![M\_G](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@M\_G](https://discourse.chef.io/u/M_G)\
**Post date:** [January 23, 2015, 8:44pm UTC](https://discourse.chef.io/t/variable-logging-levels-within-a-chef-recipe/6203/3 "2015-01-23T20:44:47Z")

</div>

Thank You Justin.

Date: Fri, 23 Jan 2015 12:30:20 -0800  
From: [justin.dossey@newcontext.com](mailto:justin.dossey@newcontext.com)  
To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
Subject: [chef] Re: Variable logging levels within a chef recipe

With a file resource, just pass the attribute:

sensitive true

and Chef won’t log the contents.

[https://docs.chef.io/chef/resources.html#id106](https://docs.chef.io/chef/resources.html#id106)

On Fri, Jan 23, 2015 at 12:09 PM, M G [meher03@hotmail.com](mailto:meher03@hotmail.com) wrote:

HI  
In the client.rb the log level is set to info  
When running a recipe, it inherits the above log level  
I have a recipe which does say three things , for example  
package "component"  
file “somefile” do  
end  
service "component service"  
When chef-client is copying the file from chef server to the node, it writes out the content of the file in the chef-client log.  
I would like to suppress logging only for that part of the recipe from within the recipe.  
Is it possible? Any pointers would be appreciated?  
Regards  
mg

–  
Justin DosseyPractice OwnerNew Context Services, Inc
