azure-functions-core-tools icon indicating copy to clipboard operation
azure-functions-core-tools copied to clipboard

How to change log level when testing locally.

Open wonboyn opened this issue 3 years ago • 3 comments
trafficstars

I'd like to be able to modify the log level when testing a function locally. I've tried setting the log level in local.settings.json but this had no impact: "logging": { "logLevel": { "FunctionApp.FunctionName": "Debug" } }

Setting the default logLevel in host.json to debug resulted in a truck load more output from the runtime but did not show the LogDebug() output from my function. Adding the attribute "FunctionApp.FunctionName": "Debug" to the logLevel in host.json also made no difference.

Can you modify the log level when running locally? If so how?

Thanks in advance.

wonboyn avatar Aug 29 '22 08:08 wonboyn

@wonboyn Does following the suggestions outlined in https://github.com/anthonychu/functions-log-suppression work for you?

michaelpeng36 avatar Aug 31 '22 18:08 michaelpeng36

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

ghost avatar Sep 04 '22 21:09 ghost

Hi @michaelpeng36 - Thanks for the info. I tried the suggestions mentioned in the link, however it did not enable me to see debug log entries. For clarity I am creating a logger via ILoggerFactory.CreateLogger<T>() in an HTTP trigger function & then subsequently issuing logger.LogDebug() & these are the entries I am not able to see locally.

wonboyn avatar Sep 06 '22 07:09 wonboyn

You don't even have to manually create a logger, it effects any of them injected via DI as well.

Clockwork-Muse avatar Feb 10 '23 19:02 Clockwork-Muse