当前位置:网站首页>Nlog自定义时间
Nlog自定义时间
2022-08-02 22:25:00 【@榴莲酥】
第一步重写 TimeSource类
/// <summary>
/// 自定义时间,网关里是的标准时间,这里我修改成北京时间
/// </summary>
[TimeSource("CustomTimeZone")]
public class CustomTimeZoneTimeSource : TimeSource
{
public override DateTime Time
{
get
{
return DateTime.UtcNow.AddHours(8);//这里你可以自定义返回时间
}
}
public override DateTime FromSystemTime(DateTime systemTime)
{
return DateTime.UtcNow.AddHours(8);//这里你可以自定义返回时间
}
}第二步,实现刚才重写的类,即可
TimeSource.Current = new CustomTimeZoneTimeSource();
GitHub Nlog自定义时间说明地址:
边栏推荐
猜你喜欢

Jmeter二次开发实现rsa加密

Week 7 CNN Architectures - LeNet-5、AlexNet、VGGNet、GoogLeNet、ResNet

Sentinel vs Hystrix 限流对比,到底怎么选?

VS保存后Unity不刷新

Jmeter二次开发实现rsa加密

1 - vector R language self-study

【使用pyside2遇到的问题】This application failed to start because no Qt platform plugin could be initialized.

Software testing pen questions 1 (with answers)

Teach you how to kill if else

TDengine 在中天钢铁 GPS、 AIS 调度中的落地
随机推荐
谷粒商城-day14-商城业务与压力测试
Teach you how to kill if else
PHP实现登录失败三次需要输入验证码需求
H5网页播放器EasyPlayer.js播放器界面的加载效果无法消失是什么原因?
The CTF command execution subject their thinking
万物智联时代,悄然走入生活
从月薪10k到30k的必走之路:自动化测试
AcWing 2983. 玩具
创建型模式 - 单例模式Singleton
软件测试笔试题1(附答案)
创建型模式 - 简单工厂模式StaticFactoryMethod
The only way to go from a monthly salary of 10k to 30k: automated testing
Rebound shell principle and implementation
【TypeScript】深入学习TypeScript类(上)
go context 包
ssm整合(三)Controller 和 视图层编写
[TypeScript] Deep Learning of TypeScript Classes (Part 1)
VS保存后Unity不刷新
Jmeter二次开发实现rsa加密
RuoYi-App启动教程