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

Constructor parameter to JsonFormatter given from xml #47

Open
Friendry opened this issue Aug 17, 2021 · 4 comments
Open

Constructor parameter to JsonFormatter given from xml #47

Friendry opened this issue Aug 17, 2021 · 4 comments

Comments

@Friendry
Copy link

Friendry commented Aug 17, 2021

Hello,
How can I add the 'renderedMessage = true' in the appsettings file for the JsonFormatter? In the code it's easy, but I haven't managed to do this in the appsettings. Normally the 'renderedMessage' is given to the constructor of the JsonFormatter. Is there a way to do this in the in the xml?

The config part of the file looks like this:

<add key="serilog:using:File" value="Serilog.Sinks.File" />
<add key="serilog:write-to:File.path" value="Logs/Log_.txt" />
<add key="serilog:write-to:File.shared" value="true" />
<add key="serilog:write-to:File.rollingInterval" value="Day" />
<add key="serilog:write-to:File.formatter" value="Serilog.Formatting.Json.JsonFormatter" />
@Friendry Friendry changed the title Custom parameter to JsonFormatter Constructor parameter to JsonFormatter given from xml Aug 17, 2021
@VictorioBerra
Copy link

VictorioBerra commented Oct 11, 2024

I just hit this now 3 years later. Anyone have an answer?

We tried:

<add key="serilog:write-to:File.formatter.renderedMessage" value="true" />
<add key="serilog:write-to:File.formatter:renderedMessage" value="true" />
<add key="serilog:write-to:File.formatter::renderedMessage" value="true" />
<add key="serilog:write-to:File.formatter_renderedMessage" value="true" />

@nblumhardt
Copy link
Member

Hi @VictorioBerra! I don't think any work's been done on this. Configuration is in a bit of an awkward spot right now, with most energy going into the Microsoft.Extensions.Configuration integration, but with some big opportunities to unify and improve all of the configuration methods still on the table. Unfortunately it's a bit of a tedious area to work in.

@VictorioBerra
Copy link

Thanks for the reply @nblumhardt

We decided to just configure this specific sink in code instead of configuration. Not ideal but it works.

@tsimbalar
Copy link
Member

This is old (and probably outdated) but at some point I tried to document the capabilities of the appsettings support ... maybe there is an example in there :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants