Best practices in developing a cookbook are to use  Usage of platform resources instead of custom ones Usage of community resources without creating a new one These techniques help us to reduce the debugging effort greatly. Main debugging techniques used to detect defects in recipes and chef-client runs are Use Empty run-list Run Chef Client with an empty run list. This helps us to make sure that the chef-client run failure is not due to the recipes added in the run list. We are also now sure that the failure is due to the configuration settings of Chef Client. chef-client run failure could also occur due to permission issues of the user at Chef Server and also on the node where Chef Client is run. Verbose logging with knife A built-in verbose logging of knife with “-v” option could be used to log messages Chef Client verbose logging Chef Client could be run with verbose logging by using the “-l” option. “-L” option could also be used to specify the location of the log file. Log resource log resource could be used to log the debug messages while running the Chef Client. This resource is also built into resource collection and run during the convergence phase. If we want to add log entries that are not added to the resource collection, use Chef:: Log. A sample log resource looks as below: log 'mtr' do
message 'A info message added.'
level :info
end Where “log” is the resource used “mtr” is the name of the resource block “message” and “level” are properties of the log resource defining the message logged and it’s level.