- From: Peter Norton <
>
- To:
- Subject: [chef] Logging less from resources, aka using the logger for logging and not STDOUT
- Date: Mon, 19 Mar 2012 13:32:26 -0400
I'm doing some work to make launching multiple systems more friendly to human observation. My specific goal right now is to force more things to go through the logger, and to only log warning or error (and not debug and info) to the console. Info and above goes to a file for later perusal if needed.
However, I'm confused by this bit of code in some of the resources:
opts[:log_tag] = @new_resource.to_s
if STDOUT.tty? && !Chef::Config[:daemon] && Chef::Log.info? # <<< this specfically
opts[:live_stream] = STDOUT
end
if I have Log.info defined, why is chef spamming stdout instead of using the logger? Wouldn't it make more sense to have one of the following two options:
1) Be able to disable live_stream from the resource
2) Have live_stream asynchronously call the logger to print log lines
The pain point here is that most of the commands that I run from chef using the execute resource are not verbose (tar, cp, etc.). However, the apt LWRP uses execute for apt-get update, etc. which is incredibly verbose and which therefore drowns out all useful info in a parallel launch. Any suggestions on how to reduce this is appreciated. The option I think I'm going to have to go with at the moment is to start monkey-patching from within client.rb, but I'd like it if there was a clearer way to deal with this.
Thanks,
-Peter
- [chef] Logging less from resources, aka using the logger for logging and not STDOUT, Peter Norton, 03/19/2012
Archive powered by MHonArc 2.6.16.