Custom format string for ${date} layout renderer

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Custom format string for ${date} layout renderer


I can't find how I can to write custom format string for the ${date} layout with colons inside like 'yyyy-MM-dd hh:mm:ss.FFF'.
When I try to use "${date:universalTime=True:format=yyyy-MM-dd hh:mm:ss.FFF}", renderer cuts the last 'ss.FFF' section.

I've looked at code and found that the method NLog.Layouts.LayoutParser.ParseParameterValue has the code processing colons and braces is placed before the code, processing backslash as a screening symbol.

I've tried to exchange these code blocks and I've got opportunity to point the format string as 'yyyy-MM-dd hh\:mm\:ss.FFF'. I think that the same issue valid for custom brace symbols in format.

Is any other way to point the string exist?