NLog时间格式 [英] NLog time formatting

查看:610
本文介绍了NLog时间格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为NLog编写一个布局,以输出像这样的11:32:08:123毫秒的时间? 我使用${date:format=yyyy-MM-dd HH\:mm\:ss},但是我的日志中需要更多的时间精度.

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.

推荐答案

${date:format=yyyy-MM-dd HH\:mm\:ss.fff}

根据 NLog文档,您可以使用C#DateTime格式字符串.

According to the NLog documentation, you can use C# DateTime format string.

这是有关DateTime格式字符串的很好的参考: http ://www.geekzilla.co.uk/View00FF7904-B510-468C-A2C8-F859AA20581F.htm

This is a pretty good reference for DateTime format strings: http://www.geekzilla.co.uk/View00FF7904-B510-468C-A2C8-F859AA20581F.htm

这篇关于NLog时间格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆