Chef log file location

I want to log from my recipe. For example i use:

log ‘message’ do
message 'This is a test message that will be added to the log.'
level :info

When executing chef-client for this recipe, i see the log in the command prompt output.
How can I log to a log file instead ?

Also, this recipe will be executed as a chef push job and after the recipe execution, i want to see the log file.
Please suggest how I can log to a log file.


Hello @agshah
Client.rb file might help you. Default value of log_location is STDOUT. You can give /path/to/log_location in place of this. You can locate this client.rb file in C:\chef\client.rb or /etc/chef/client.rb directories.

thanks very much. I tried this and it generated the log on the node where the recipe was run.
I am executing recipe on the node by using push jobs from the workstation.
The log gets written on the node but is there a way to get the log on the workstation?
Because, i need to to know on the workstation after the push job is complete to see the entries that
i write to the log.