study
parent
32ba26cf0f
commit
d29bfc0088
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
|
||||
</startup>
|
||||
</configuration>
|
@ -0,0 +1,41 @@
|
||||
<?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"
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
keepVariablesOnReload="false"
|
||||
throwExceptions="true"
|
||||
throwConfigExceptions="true"
|
||||
internalLogLevel="Trace"
|
||||
internalLogFile="${basedir}\logs\internal-nlog.txt"
|
||||
>
|
||||
<!--引入Nlog扩展包-->
|
||||
<extensions>
|
||||
<!--<add assembly="NLog.Web.AspNetCore"/>-->
|
||||
</extensions>
|
||||
|
||||
<!--自定义变量-->
|
||||
<variable name="myvariable" value="test" />
|
||||
|
||||
<!--设置目标-->
|
||||
<targets>
|
||||
<!--默认彩色控制台-->
|
||||
<target xsi:type="ColoredConsole"
|
||||
name="ColoredConsoleLog"
|
||||
encoding="utf-8"
|
||||
layout="${longdate}|${level:uppercase=true}|${logger}|${message}"
|
||||
/>
|
||||
|
||||
<!--写入日志文件-->
|
||||
<target xsi:type="File"
|
||||
name="allfile"
|
||||
fileName="${basedir}\logs\nlog-all-${shortdate}.log"
|
||||
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}" />
|
||||
</targets>
|
||||
|
||||
<!--设置规则-->
|
||||
<rules>
|
||||
<logger ruleName="*" minlevel="Trace" writeTo="ColoredConsoleLog" />
|
||||
<logger ruleName="*" minlevel="Trace" writeTo="allfile" />
|
||||
</rules>
|
||||
</nlog>
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.6.8" targetFramework="net48" />
|
||||
</packages>
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<?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"
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
keepVariablesOnReload="false"
|
||||
throwExceptions="true"
|
||||
throwConfigExceptions="true"
|
||||
internalLogLevel="Warn"
|
||||
internalLogFile="${basedir}\logs\internal-nlog.txt"
|
||||
>
|
||||
<!--引入Nlog扩展包-->
|
||||
<extensions>
|
||||
<!--<add assembly="NLog.Web.AspNetCore"/>-->
|
||||
<!--<add assembly="NLog.Redis"/>-->
|
||||
<!--<add assembly="NLog.Targets.Redis" />-->
|
||||
</extensions>
|
||||
|
||||
<!--自定义变量-->
|
||||
<variable name="myvariable" value="test" />
|
||||
|
||||
<!--设置目标-->
|
||||
<targets>
|
||||
<target xsi:type="ColoredConsole" name="consoleTarget"/>
|
||||
</targets>
|
||||
<rules>
|
||||
<logger name="*" minlevel="Info" writeTo="consoleTarget" />
|
||||
</rules>
|
||||
</nlog>
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Debug",
|
||||
"System": "Information",
|
||||
"Microsoft": "Information"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"NLog":"server=127.0.0.1;port=3306;user=root;password=yt-461400;database=nlog;Sslmode=None;Character Set=utf8;"
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
<?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"
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
keepVariablesOnReload="false"
|
||||
throwExceptions="true"
|
||||
throwConfigExceptions="true"
|
||||
internalLogLevel="Trace"
|
||||
internalLogFile="${basedir}\logs\internal-nlog.txt"
|
||||
>
|
||||
<!--引入Nlog扩展包-->
|
||||
<extensions>
|
||||
<add assembly="NLog.Web.AspNetCore"/>
|
||||
</extensions>
|
||||
|
||||
<!--自定义变量-->
|
||||
<variable name="myvariable" value="test" />
|
||||
|
||||
<!--设置目标-->
|
||||
<targets>
|
||||
<!--默认彩色控制台-->
|
||||
<target xsi:type="ColoredConsole"
|
||||
name="ColoredConsoleLog"
|
||||
encoding="utf-8"
|
||||
layout="${longdate}|${level:uppercase=true}|${logger}|${message}">
|
||||
</target>
|
||||
<!--调试窗口-->
|
||||
<target name="debugLog" xsi:type="Debugger" layout="${logger}::${message}"></target>
|
||||
|
||||
<!--写入日志文件-->
|
||||
<target xsi:type="File"
|
||||
name="allfile"
|
||||
fileName="${basedir}\logs\nlog-all-${shortdate}.log"
|
||||
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}">
|
||||
</target>
|
||||
<target xsi:type="Database"
|
||||
name="MySQLTarget"
|
||||
dbProvider="MySql.Data.MySqlClient.MySqlConnection, MySqlConnector"
|
||||
keepConnection="false"
|
||||
commandType="Text"
|
||||
commandText="insert into applog (zl_timestamp, zl_user, zl_level, zl_type, zl_message, zl_exception, zl_project) values (@timestamp,@user,@level,@type,@message,@exception,@project);"
|
||||
>
|
||||
<parameter name="@timestamp" layout="${longdate}"/>
|
||||
<parameter name="@user" layout="${event-context:item=user}"/>
|
||||
<parameter name="@level" layout="${level}"/>
|
||||
<parameter name="@type" layout="${event-context:item=type}"/>
|
||||
<parameter name="@message" layout="${message}"/>
|
||||
<parameter name="@exception" layout="${exception:tostring}"/>
|
||||
<parameter name="@project" layout="${event-context:item=project}"/>
|
||||
</target>
|
||||
</targets>
|
||||
|
||||
<!--设置规则-->
|
||||
<rules>
|
||||
<logger ruleName="*" minlevel="Warn" writeTo="ColoredConsoleLog,debugLog,MySQLTarget" />
|
||||
</rules>
|
||||
</nlog>
|
Loading…
Reference in New Issue