MESSeries_Bate/MESws_STD/NLog.config

112 lines
5.2 KiB
Plaintext
Raw Normal View History

2025-05-20 17:00:22 +08:00
<?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="c:\temp\nlog-internal.log">
<!-- optional, add some variables
https://github.com/nlog/NLog/wiki/Configuration-file#variables
-->
<!--Notes
please note that the method name won't work well with async methods before NLog 4.3 - it will always show MoveNext.
Please also note that this infers heavy performance hit when doing lots of logging, as it has to capture full StackTrace for every log message.
If symbol symbol information is not available, then it will not be able to output source-code filename or line-number. Symbol information from PDB files must be deployed with the application to retrieve and output source-code line-number. For applications compiled in release mode, then inlining can occur and cause "unexpected" line-numbers.
-->
<variable name="STDLayout" value="${longdate} | [${level:uppercase=true}] | [${threadid}] | [${callsite}]${newline}[${event-properties:item=caller}]${newline}${message}${newline}${exception:format=ToString}${newline}"/>
<variable name="BasePath" value="${basedir}/Logs/"/>
<variable name="STDPath" value="${BasePath}/STD/Cur_${level:uppercase=true}.log"/>
<variable name="ArchivePath" value="${BasePath}/STD/${level:uppercase=true}_{#}.log"/>
<variable name="EAIPath" value="${BasePath}/EAI/Cur_${level:uppercase=true}.log"/>
<variable name="EAIArchivePath" value="${BasePath}/EAI/${level:uppercase=true}_{#}.log"/>
<variable name="CustomerPath" value="${BasePath}/${event-properties:item=NameSpace}/Cur_${level:uppercase=true}.log"/>
<variable name="CustomerArchivePath" value="${BasePath}/${event-properties:item=NameSpace}/${level:uppercase=true}_{#}.log"/>
<variable name="ArchiveSize" value ="5242880"/>
<variable name="TestSize" value ="1024"/>
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<targets async="true">
<!--
add your targets here
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
-->
<!--
Write events to a file with the date in the filename.
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
-->
<target name="STDFile" xsi:type="File" fileName="${STDPath}" layout="${STDLayout}"
archiveFileName="${ArchivePath}"
archiveAboveSize="${ArchiveSize}"
archiveNumbering ="DateAndSequence"
archiveEvery="Hour"
archiveDateFormat ="yyyy-MM-dd-HH"
maxArchiveDays="7"
encoding="utf-8"
/>
<target name="EAIFile" xsi:type="File" fileName="${EAIPath}" layout="${STDLayout}"
archiveFileName="${EAIArchivePath}"
archiveAboveSize="${ArchiveSize}"
archiveNumbering ="DateAndSequence"
archiveEvery="Hour"
archiveDateFormat ="yyyy-MM-dd-HH"
maxArchiveDays="7"
encoding="utf-8"
/>
<target name="CustomerFile" xsi:type="File" fileName="${CustomerPath}" layout="${STDLayout}"
archiveFileName="${CustomerArchivePath}"
archiveAboveSize="${ArchiveSize}"
archiveNumbering ="DateAndSequence"
archiveEvery="Hour"
archiveDateFormat ="yyyy-MM-dd-HH"
maxArchiveDays="7"
encoding="utf-8"
/>
</targets>
<rules>
<!-- add your logging rules here -->
<!--
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
<logger name="*" minlevel="Debug" writeTo="f" />
-->
<!--針對logger levels內的項目增加、刪除,以開啟關閉Log的紀錄。-->
<!--kc*、tc*、ud*目前使用Debug、Error記錄kcXXX、udXXX、tcXXX執行的SQL語句-->
<!--MEStc*、ASM目前使用Debug、Error記錄客製化tc執行的SQL語句-->
<!--MESws*目前使用Info、Debug、Error記錄MESws_STD接口傳入的參數與回傳的資訊-->
<!--tcEAI目前使用Debug、Error記錄tcEAI執行的SQL語句-->
<!--EAIws*目前使用Info記錄EAIws接口傳入的參數與回傳的資訊-->
<logger name="tcEAI*" levels="Trace,Debug,Info,Warn,Error,Fatal" writeTo="EAIFile" final="true"/>
<logger name="EAIws*" levels="Trace,Debug,Info,Warn,Error,Fatal" writeTo="EAIFile" final="true"/>
<logger name="kc*" levels="Trace,Debug,Info,Warn,Error,Fatal" writeTo="STDFile"/>
<logger name="tc*" levels="Trace,Debug,Info,Warn,Error,Fatal" writeTo="STDFile"/>
<logger name="ud*" levels="Trace,Debug,Info,Warn,Error,Fatal" writeTo="STDFile"/>
<logger name="MESws*" levels="Trace,Debug,Warn,Error,Fatal" writeTo="STDFile"/>
<logger name="MEStc*" levels="Trace,Debug,Info,Warn,Error,Fatal" writeTo="CustomerFile"/>
<logger name="ASM" levels="Trace,Debug,Info,Warn,Error,Fatal" writeTo="CustomerFile"/>
<logger name="General" levels="Trace,Debug,Info,Warn,Error,Fatal" writeTo="STDFile"/>
</rules>
</nlog>