博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
NLog自定义字段写入数据库表,示例
阅读量:7123 次
发布时间:2019-06-28

本文共 905 字,大约阅读时间需要 3 分钟。

//自定义字段写入NLog日志private void saveNLog(InvokeLogModel model){LogEventInfo ei = new LogEventInfo();ei.Properties["InvokeResult"] = model.InvokeResult;ei.Properties["RequestUrl"] = model.RequestUrl;ei.Properties["MethodName"] = model.MethodName;ei.Properties["InvokeUserName"] = model.InvokeUserName;ei.Properties["InputJson"] = model.InputJson;ei.Properties["OutputJson"] = model.OutputJson;ei.Properties["BeginTime"] = model.BeginTime;ei.Properties["EndTime"] = model.EndTime;//ei.Message = "my test log message";ei.Level = LogLevel.Info;nlogger.Log(ei);}//配置读取自定义字段
INSERT INTO [LogInfo].[InterfaceBeInvokedLog]([LogLevel],[InvokeResult],[InvokeUserName],[RequestUrl],[MethodName],[InputJson],[OutputJson],[BeginTime],[EndTime])values (@LogLevel, @InvokeResult, @InvokeUserName, @RequestUrl, @MethodName, @InputJson, @OutputJson, @BeginTime, @EndTime);

 

转载地址:http://kcael.baihongyu.com/

你可能感兴趣的文章
封装性
查看>>
如何在适合OpenCart系统运行的美国服务器空间建立SMTP服务
查看>>
JAVA中int、String的类型转换
查看>>
MongoDB Could not find host matching read preference { mode: \"primary\" } for set repl_shard1
查看>>
SOAP webserivce 和 RESTful webservice 对比及区别
查看>>
系统操作日志设计
查看>>
spring boot 资料
查看>>
iOS5系统API和5个开源库的JSON解析速度测试
查看>>
iOS入门实例文章目录
查看>>
android Activity.java 源码
查看>>
Override VK_TTALK & VK_TEND
查看>>
mysql使用MRG_MyISAM(MERGE)实现水平分表
查看>>
Kurento应用安全
查看>>
移动开发(IOS) – Objective-C-01-概述
查看>>
iOS与JS交互02
查看>>
linux 下几个奇奇怪怪的文件系统
查看>>
snapmanager for exchange
查看>>
Spring事务类型详解
查看>>
LinkedList类
查看>>
位运算基础知识
查看>>