Serilog: string is always rendered with quotes

Created on 29 Jun 2017  路  3Comments  路  Source: serilog/serilog

I am trying to log strings without quotes. According to this...

(Serilog renders string values in double quotes to more transparently indicate the underlying data type, and to make the property value stand out from the surrounding message text. To omit the quotes, use the :l literal format specifier on the property, e.g. {User:l}.)

...I should just add ":1" to my properties. I tried that and the strings are still surrounded by quotes.

Also, I should mention that I am seeing this in a log file that was generated by serilog.extensions.logging.file.

Thx

Most helpful comment

Hi @riiight, that should be :l (the letter L) and not :1 (the number 1).

All 3 comments

Hi @riiight, that should be :l (the letter L) and not :1 (the number 1).

Thank you! Silly mistake on my part.

@riiight if you can consider a switch to use the underlying _Serilog.Sinks.RollingFile_ sink directly, with Serilog 2.5 you can specify the :l once only in the sink's output template. See: #956. Cheers!

Was this page helpful?
0 / 5 - 0 ratings