Nlog 日誌框架簡單教程
安裝 |
Nuget獲取 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
配置尋找 |
會自動尋找在應用程序目錄下的NLog.config(大小寫敏感) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
如何配置config |
<?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" throwExceptions="false" internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log"> <targets> <target xsi:type="File" name="debug1" fileName="..\..\Layout\CsvLayout.config"/> </targets> <rules> <logger name="*" level="Debug" writeTo="debug1" /> </rules> </nlog>
配置主要有兩個節點
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
應用程序應用 |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
FAQ |
如還需要更多配置,請看https://nlog-project.org/config/?tab=targets |
整理了這麽一張圖,需要學習的主要其實就是配置文件
稍後還會有一些管飯教程的翻譯發上來
:)
Nlog 日誌框架簡單教程