Azure / Azure/azure-functions-host

More advanced log configuration

Open
#4,405 15 comments 0 reactions 0 assignees View on GitHub
docs
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 10h
Merged PRs (30d)
36

Description

`Microsoft.Azure.Functions.Extensions` brought us the first attempt of being able to configure custom logging providers in Functions. With the current solution (where I can inject an `ILoggerProvider`), I can configure functions to log everything to a single log output. I would like to be able to do much more advanced logging configuration, though. Being able to register multiple logging provider, decide which log levels goes into which logs, and other features like that, is an essential part of most applications today.

Ideally, logging would be configured like any other application using Microsoft.Extensions.Logging:

```csharp
[assembly: FunctionsStartup(typeof(MyNamespace.Startup))]

namespace MyNamespace
{
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
...
builder.Services.AddLogging(logging =>
{
logging.AddConfiguration(config.GetSection("Logging"));
logging.AddConsole();
logging.AddDebug();
logging.AddEventSourceLogger();
});
}
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start by reading the current Microsoft.Azure.Functions.Extensions integration around ILoggerProvider, FunctionsStartup, IFunctionsHostBuilder, and Services.AddLogging. Determine how Microsoft.Extensions.Logging configuration is currently wired, then define tests for multiple providers, per-provider log levels, and the logging configuration shown in the issue; done means those scenarios work through FunctionsStartup.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.