Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flexible configuration of logging providers #1429

Open
thompson-tomo opened this issue Jan 14, 2025 · 1 comment
Open

Flexible configuration of logging providers #1429

thompson-tomo opened this issue Jan 14, 2025 · 1 comment
Labels
Type/enhancement New feature or request

Comments

@thompson-tomo
Copy link
Contributor

thompson-tomo commented Jan 14, 2025

Is your feature request related to a problem? Please describe.

I want the logger management endpoint to be more supportive of different providers

Describe the solution you'd like

When the actuator is initialised we are able to configure the following:

  • provider: where the endpoint goes to source & store configuration values

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

A public interface needs to be exposed to support custom providers and multiple providers can be added with the response combined. The interface needs to provide a

  • getLoggers
  • getGroups, default implementation returns null
  • setLogger
  • setGroup
  • getLevels

Initial release should have support for

  • Microsoft
  • Steeltoe? TBD: Do we need to Port current solution across or can it be discontinued
  • Serilog? Should It be split to seperate issue

Future release should have support for (seperate issues to be created):

  • Nlog
@thompson-tomo thompson-tomo added the Type/enhancement New feature or request label Jan 14, 2025
@bart-vmware
Copy link
Member

bart-vmware commented Jan 14, 2025

I want the logger management endpoint to be more supportive of different providers

That's pretty vague to me. Can you be more specific? What problem would this solve?

When the actuator is initialised we are able to configure the following:

  • provider: where the endpoint goes to source & store configuration values

The loggers actuator depends on IDynamicLoggerProvider in the service container. Implementations are responsible for returning the active levels and changing minimum levels. So this is already possible. Steeltoe provides implementations for the .NET ILogger abstractions, as well as Serilog. Initial levels are read from IConfiguration in these implementations, which provides flexibility in where the settings originate from.

multiple providers can be added with the response combined

Are you saying you'd like to use multiple logging frameworks at the same time? I don't think that makes sense. If provider A configures MyCompany.MyApp.Controllers at level Trace, while provider B configures that category at level Info, how do we determine which one wins when combining? This is also why Steeltoe offers DynamicConsoleLoggerProvider; settings for console may be different from global settings or other outputs.

The interface needs to provide a

  • getLoggers
  • getGroups, default implementation returns null
  • setLogger
  • setGroup
  • getLevels

See IDynamicLoggerProvider, which already provides what the loggers actuator needs. GetLoggers (presumably returning ILogger instances) is not exposed, because it is an implementation detail that depends on the underlying logging framework. GetGroups/SetGroup is currently not supported, we already have an open issue to provide that.

We already have an open issue for adding NLog support. As stated there, we're not fundamentally against it, but it is not a priority. Mentioning NLog should be included repeatedly isn't going to change that. We recently checked for usage and found that NLog is half as popular as Serilog.

See also #1430 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants