Chef::log not printing for console in Chef-Client 16.6.14

How to print log in console window while executing chef command with Chef-Client 16.6.14?
Log is being generated only in logfile on giving a log path through -L/--logfile.

Did you find solution to this? In my case, I don't see log output on the jenkins console.

By default the formatter suppressed :info output so all that is displayed is :warn or higher

So we'd recommend trying Chef::Log.warn instead of

1 Like

Thanks. But we have thousands of code lines with So changing all to warn is difficult. How do we override the default behavior to force formatter to not suppress :info output?

FYI- I am upgrading from Chef client 14 to 16. I am expecting output on Jenkins console. With chef client 14, it's all good.

Any help would be appreciated!

Would chef-client -l info --force-formatter achieve what you're after ?

This did not help. I have noticed that when I put --logfile parameter in my chef command, the logs are only getting written to the log file and not to STDOUT. This was a change done as part of chef 16 upgrade ( End the formatter and logger confusion and have the formatter output log messages · Issue #9126 · chef/chef (
As a workaround, Since I am calling from a powershell script, I am redirecting the output of the command to the file (instead of using --logfile)

$timestamp = Get-Date -UFormat "%Y-%m-%d-%H-%M-%S"
Invoke-Command -ComputerName $servername -ScriptBlock{param ($timestamp) chef-client --config c:\chef\client-local-mode.rb -o recipe[jdk_common] | Tee-Object -FilePath c:\chef\chef-client-$timestamp.log} -ArgumentList $timestamp
Invoke-Command -ComputerName $servername -FilePath .\install\ChefStatus.ps1 -ArgumentList $hostname, chef-client-$timestamp.log