serilog-settings-appsettings icon indicating copy to clipboard operation
serilog-settings-appsettings copied to clipboard

AppSettings for DLL library

Open DiskCrasher opened this issue 5 years ago • 2 comments

A few questions before you begin:

Is this an issue related to the Serilog core project or one of the sinks or community projects. This issue list is intended for Serilog core issues. If this issue relates to a sink or related project, please log on the related repository. Please use Gitter chat and Stack Overflow for discussions and questons.

Does this issue relate to a new feature or an existing bug?

  • [ ] Bug
  • [ x ] New Feature

What version of Serilog is affected? Please list the related NuGet package. SeriLog 2.8

What is the target framework and operating system? See target frameworks & net standard matrix.

  • [ ] netCore 2.0
  • [ ] netCore 1.0
  • [ x ] 4.7
  • [ ] 4.6.x
  • [ ] 4.5.x

Please describe the current behavior? Currently SeriLog can read settings from an app.config or web.config file using AppSettings. However, for a DLL library there is no such file. The typical argument is that the calling app should control the settings. But if there are several calling apps using the same library this can become cumbersome very quickly.

Please describe the expected behavior? There should be a way to set the logging behaviors (e.g. level) in an XML file for DLL libraries too. (Coming from log4net where this behavior is supported.)

If the current behavior is a bug, please provide the steps to reproduce the issue and if possible a minimal demo of the problem

DiskCrasher avatar Jul 29 '19 21:07 DiskCrasher

Thanks for the suggestion. It's not immediately clear that Serilog's model can accommodate this - some investigation of a possible API and scenarios is needed.

nblumhardt avatar Jul 29 '19 22:07 nblumhardt

This use case describes a similar scenario to how I intend to use it. DiskCrasher - I've actually loaded my settings from a 'serilog.config' file that I've setup that's just structured in the same format as an app.config. You can reference this in your dll.config. I'll try to remember tomorrow to post some snippets. (Remind me if I don't)

ltoshea avatar Aug 04 '19 18:08 ltoshea