question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[QUERY] How to stop function log spam in console app for .NET 6 / V4 functions

See original GitHub issue

Library name and version

Azure.Messaging.ServiceBus 7.5.1

Query/Question

Previous version (NET Core 3.1), we could watch the consoles and follow app behavior, now almost all of the console output is functionally spam.

I want to filter out

[2022-02-01T23:49:22.524Z] topic/Subscriptions/function-480d862d-84c0-4355-b2ca-3617ee49eb8f: ReceiveBatchAsync done. Received '0' messages. LockTokens =
[2022-02-01T23:49:23.876Z] topic/Subscriptions/function-480d862d-84c0-4355-b2ca-3617ee49eb8f: ReceiveBatchAsync start. MessageCount = 1

Which occur at least 100 per function and

[2022-02-01T23:52:30.582Z] Request [1a524b29-cbb5-4e18-aa28-cc84d04e08b0] PUT http://127.0.0.1:10000/devstoreaccount1/azure-webjobs-hosts/locks/user-858520082/host?comp=lease
[2022-02-01T23:52:30.587Z] x-ms-lease-action:renew
[2022-02-01T23:52:30.587Z] x-ms-lease-id:0000000000000000000000002C8741E3
[2022-02-01T23:52:30.588Z] x-ms-version:2020-08-04

which is less frequent but still relatively significant pollution.

I’ve tried modifying the host.json from Default “debug”, to only display information

  "logging": {
    "logLevel": {
      "Default": "Information",
      "System": "Information",
      "Microsoft": "Warning"
    }
  }

and it didn’t reduce logging, and I’m afraid that if we reduce the logging level further that we’re just going to be obfuscating the information we want, because we used to be able to see when a function picked up a message and then when it marked it as complete, as well as internal logging data.

Environment

.NET 6 VS 2022

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
jsquirecommented, Feb 2, 2022

Hi @Prinsn. Thank you for reaching out. To change the log detail that you’re seeing for Service Bus or other Azure SDK packages, you’ll need to configure their levels independently. For example, if you wanted to restrict Service Bus to just warnings and errors, you’d use something similar to:

"Logging": {
  "LogLevel": {
    "Default": "Information",
    "System": "Information",
    "Microsoft": "Warning"
    "Azure.Messaging.ServiceBus": "Warning"
  }
}

There’s a bit more context in the discussion on #25865, if you’re interested.

2reactions
Prinsncommented, Feb 2, 2022

You and Josh are really doing serious work with this repo.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stop an Azure Function from logging the “Executing” and “ ...
Go to Azure portal, Platform features> Function app settings> host.json ... which means we can still see them in console or file logs....
Read more >
Guide for running C# Azure Functions in an isolated worker ...
Learn how to use a .NET isolated worker process to run your C# functions in Azure, which supports non-LTS versions of .NET and...
Read more >
Logging query language
You can use the Logging query language in the Logs Explorer in the Google Cloud console, the Logging API, or the command-line interface....
Read more >
Debugging Azure Functions
Provide a developer's overview on how to debug your Azure Functions locally or against a remote Azure.
Read more >
How to enable verbose logging for Azure Functions?
This post describes how you can easily enable debug/verbose information for your Azure Functions for a lightweight and built-in way to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found