Skip to content

Instantly share code, notes, and snippets.

@jelder
Created July 25, 2012 15:27
Show Gist options
  • Save jelder/3176777 to your computer and use it in GitHub Desktop.
Save jelder/3176777 to your computer and use it in GitHub Desktop.
Chef logs: threat or menace?
[2012-07-25T15:22:50+00:00] INFO: Processing log[my message] action write (example::default line 5)
[2012-07-25T15:22:50+00:00] INFO: my message
# Chef's logging mechanism is laughably verbose. The most trivial message will
# be logged twice, and the most common need, to see only the changes made to
# a system, is impossible.
log "my message"
@btm
Copy link

btm commented Jul 25, 2012

There are a lot of opinions on logging and there have been long threads on the Chef mailing list as to what different people prefer.

Those two messages serve entirely different purposes. The first line is a higher level message that tells you what resource is being run. This is useful if you have a resource that isn't doing anything and you want to make sure it's really getting evaluated. If you personally don't find the 'Processing' messages useful, you should set "verbose_logging false" in your chef.rb. The second line, of course, is user generated.

I'm not sure what you're implying would be ideal logging for you.

The new doc formatters that will be in Chef 10.14.0 as part of why-run mode may be of interest to you.

$ sudo chef-client -Fdoc -lfatal -j apt.json
Starting Chef Client, version 10.14.0.beta.2
resolving cookbooks for run list: ["apt", "apt::update"]
Synchronizing Cookbooks:
  - apt
Compiling Cookbooks...
Converging 7 resources
Recipe: apt::default
  * execute[apt-get-update] action run (skipped due to not_if)
  * execute[apt-get update] action nothing (up to date)
  * package[update-notifier-common] action install (up to date)
  * execute[apt-get-update-periodic] action run (skipped due to only_if)
  * directory[/var/cache/local] action create
    - create new directory /var/cache/local
    - change mode from '' to '0644'
    - change owner from '' to 'root'
    - change group from '' to 'root'
  * directory[/var/cache/local/preseeding] action create
    - create new directory /var/cache/local/preseeding
    - change mode from '' to '0644'
    - change owner from '' to 'root'
    - change group from '' to 'root'
Recipe: apt::update
  * execute[apt-get update] action run
    - execute apt-get update
Chef Client finished, 3 resources updated
$ sudo chef-client -Fminimal -lfatal -j apt.json
Starting Chef Client, version 10.14.0.beta.2
resolving cookbooks for run list: ["apt", "apt::update"]
Synchronizing cookbooks
.done.
Compiling cookbooks
....done.
Converging 7 resources
S..S..U
System converged.

resources updated this run:
* execute[apt-get update]
  - execute apt-get update

chef client finished, 1 resources updated

@adamhjk
Copy link

adamhjk commented Jul 25, 2012

Also, you can turn off the "Processing" lines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment