How do I write a layout for NLog that outputs time with milliseconds like this 11:32:08:123
?
I use ${date:format=yyyy-MM-dd HH\:mm\:ss}
but I need more time precision in my logs.
相关问题
- Using Nlog to write structured logs to Google Stac
- Custom target with injected services for NLog with
- NLog Archive configuration
- NLog: logging an object serialized to JSON
- Is there a way to set the minlevel of a NLog logge
相关文章
- NLog not working in release mode
- Are there any alternatives to Common.Logging? [clo
- Prevent NLog from rendering inner text when layout
- Print a multi-line message with NLog
- using Nlog and writing to file as json
- Using Stored Procedure in NLog on a Database targe
- How to use NLog for a DLL
- NLog Exception when parsing nlog.config - Target c
Another alternative to the format suggested by harriyott is to use the ${longdate} renderer. It should automatically give you the precision you need.
Another alternative solution is to use the ISO 8601 format '1998-02-23T14:23:05.555'. This format is independet of the languange of the sql server.
${date:format=yyyy-MM-dd HH\:mm\:ss.fff}
According to the NLog documentation, you can use C# DateTime format string.
This is a pretty good reference for DateTime format strings: http://www.geekzilla.co.uk/View00FF7904-B510-468C-A2C8-F859AA20581F.htm