You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CoreShop/CoreCms.Net.Web.Admin/NLog.config

75 lines
4.5 KiB
Plaintext

<?xml version="1.0" encoding="utf-8"?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autoReload="true" throwExceptions="false" internalLogLevel="Off" internalLogFile="NlogRecords.log">
<!--Nlog内部日志记录为Off关闭。除非纠错不可以设为Trace否则速度很慢起码Debug以上-->
<extensions>
<add assembly="NLog.Web.AspNetCore" />
</extensions>
<targets>
<!--通过数据库记录日志 配置
dbProvider请选择mysql或是sqlserver同时注意连接字符串,需要安装对应的sql数据提供程序
MYSQL:
dbProvider="MySql.Data.MySqlClient.MySqlConnection, MySql.Data"
connectionString="server=localhost;database=BaseMIS;user=root;password=123456"
MSSQL:
dbProvider="Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient"
connectionString="Server=127.0.0.1;Database=BaseMIS;User ID=sa;Password=123456"
-->
!61 日常修复,删除类型模型,调整为sku模型及参数模型直接灵活捆绑商品。 * 更新数据库及脚本 * 2021-07-20 * Merge branch 'develop' into dahuihui/develop * 修复webapi不进入调试断点的问题。 * Merge branch 'develop' into dahuihui/develop * 修复后台前后端分离table面板启用自定义域名问题。 * 修复后台前后端分离域名未增加到html问题。 * Merge branch 'develop' into dahuihui/develop * 【后端】修复修改登录用户真实姓名长度问题。 * 修复后台管理配送方式维护错误问题 * 1、修复小程序注册问题,导致交互事情。不然盛派的组件有bug,在不注册微信公众号只注册微信小程序的时候,进行小程序消息操作,默认还是走的是微… * 修复消息模板不推送的问题 * Merge branch 'develop' into dahuihui/develop * Merge branch 'develop' into dahuihui/develop * 修复过期失效文档 * 调整代码生成器,增加初始化事务 * 调整接口端提示界面 * 修复弹窗不居中问题 * 调整一些命名方式 * 修复uni-app前端,用户订单列表【确认收货】按钮失效问题 * 1、修复mysql数据库下,报表统计sql的语法错误。2、为方便前端在不部署接口及后端的情况下测试uni-app前端,默认增加了测试接口地址… * Merge branch 'develop' into dahuihui/develop * 调整命名 * 增加docker-compose部署 * Merge branch 'develop' into dahuihui/develop * 修复因linux下存在数据与文件名称大小写不对应,导致找不到数据库表的问题,特重新发布一份表名与实体名称一一对应脚本。 * 新mysql表名存在大小写问题
4 years ago
<target name="log_database" xsi:type="Database" dbProvider="Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient" connectionString="Server=127.0.0.1;uid=CoreShop;pwd=CoreShop;Database=CoreShop;MultipleActiveResultSets=true;">
<commandText>
INSERT INTO SysNLogRecords
(LogDate,LogLevel,LogType,LogTitle,Logger,Message,MachineName,MachineIp,NetRequestMethod
,NetRequestUrl,NetUserIsauthenticated,NetUserAuthtype,NetUserIdentity,Exception)
VALUES
(@LogDate,@LogLevel,@LogType,@LogTitle,@Logger,@Message,@MachineName,@MachineIp,@NetRequestMethod
,@NetRequestUrl,@NetUserIsauthenticated,@NetUserAuthtype,@NetUserIdentity,@Exception);
</commandText>
<parameter name="@LogDate" layout="${date}" />
<parameter name="@LogLevel" layout="${level}" />
<parameter name="@LogType" layout="${event-properties:item=LogType}" />
<parameter name="@LogTitle" layout="${event-properties:item=LogTitle}" />
<parameter name="@Logger" layout="${logger}" />
<parameter name="@Message" layout="${message}" />
<parameter name="@MachineName" layout="${machinename}" />
<parameter name="@MachineIp" layout="${aspnet-request-ip}" />
<parameter name="@NetRequestMethod" layout="${aspnet-request-method}" />
<parameter name="@NetRequestUrl" layout="${aspnet-request-url}" />
<parameter name="@NetUserIsauthenticated" layout="${aspnet-user-isauthenticated}" />
<parameter name="@NetUserAuthtype" layout="${aspnet-user-authtype}" />
<parameter name="@NetUserIdentity" layout="${aspnet-user-identity}" />
<parameter name="@Exception" layout="${exception:tostring}" />
</target>
<target xsi:type="File" name="log_file" fileName="${basedir}/App_Data/nlog/${date:format=yyyy-MM}/${level}-${shortdate}.csv" encoding="utf-8">
<layout xsi:type="CSVLayout">
<column name="date" layout="${date}" />
<column name="LogTitle" layout="${event-properties:item=LogTitle}" />
<column name="message" layout="${message}" />
<column name="exception" layout="${exception:format=tostring}" />
<column name="machinename" layout="${machinename}" />
<column name="appdomain" layout="${appdomain}" />
<column name="assembly-version" layout=" ${assembly-version}" />
<column name="basedir" layout="${basedir}" />
<column name="callsite" layout="${callsite}" />
<column name="counter" layout="${counter}" />
<column name="nlogdir" layout="${nlogdir}" />
<column name="processid" layout="${processid}" />
<column name="processname" layout="${processname}" />
<column name="specialfolder" layout="${specialfolder}" />
<column name="stacktrace" layout="${stacktrace}" />
<column name="longdate" layout="${longdate}" />
<column name="event-properties" layout="${event-properties:item=EventId_Id}" />
<column name="uppercase" layout="${uppercase:${level}}" />
<column name="logger" layout="${logger}" />
<column name="url" layout="${aspnet-request-url}" />
<column name="action" layout="${aspnet-mvc-action}" />
</layout>
</target>
</targets>
<rules>
<!--跳过所有级别的Microsoft组件的日志记录-->
<logger name="Microsoft.*" final="true" />
<!-- BlackHole without writeTo -->
<!--只通过数据库记录日志如果给了name名字cs里用日志记录的时候取logger需要把name当做参数-->
<logger name="logdb" writeTo="log_database" />
<logger name="logfile" writeTo="log_file" />
</rules>
</nlog>