-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Date layout renderer
Current date and time.
Platforms Supported: All
Alternative ${longdate} or ${shortdate} can be used for high performance timestamp-logging.
${date:universalTime=Boolean:format=String:culture=Culture}
-
universalTime - Indicates whether to output UTC time instead of local time.Boolean Default: False
-
format - Date format. Can be any argument accepted by DateTime.ToString(format).
Note that colons need to escaped with a backslash:
Example:${date:format=yyyy-MM-dd HH\:mm\:ss.fff}
->DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")
->"2000-01-01 00:00:00.000"
Note that backslashes, that shall be passed through, also need to be escaped:
Example:${date:format=\\Yyyyy\\MMM\\Ddd}
->DateTime.Now.ToString(@"\Yyyyy\MMM\Ddd")
->Y2000M01D01"
-
culture - Culture used for rendering. Default: InvariantCulture
- Troubleshooting Guide - See available NLog Targets and Layouts: https://nlog-project.org/config
- Getting started
- How to use structured logging
- Troubleshooting
- FAQ
-
All targets, layouts and layout renderers
Popular: - Using NLog with NLog.config
- Using NLog with appsettings.json