NLog使用方法

2021-09-07 21:51:48 字數 962 閱讀 4946

一、軟體**:

二、 winform下使用

新增nlog.dll的引用,然後在nlog.dll的資料夾下建立nlog.dll.nlog

內容如下:

<?xml version="1.0" encoding="utf-8" ?>

schemas/nlog.xsd"

xmlns:xsi="" >

在你要寫日誌的類中如下使用:

using system;

using system.collections.generic;

using system.componentmodel;

using system.data;

using system.drawing;

using system.text;

using system.windows.forms;

namespace nlogdemo

private void button1_click(object sender, eventargs e)}}

三、webform,asp.net下的使用方法

同樣新增nlog.dll,不過這次的配置檔案放到web.config中

如下:<?xml version="1.0"?>

使用方法如下,default.aspx.cs

using system;

using system.collections.generic;

using system.web;

using system.web.ui;

using system.web.ui.webcontrols;

using devexpress.xtracharts;

public partial class _default : system.web.ui.page 

}更加詳細的使用可以參考:

nlog doc 

nlog文章系列 

NLog簡單使用

一 安裝 二 安裝後會在根目錄出現nlog.config配置檔案,簡單修改配置檔案為寫入檔案記錄日誌 xml version 1.0 encoding utf 8 nlog xmlns xmlns xsi xsi schemalocation nlog.xsd autoreload true thr...

nlog官方幫助 NLog的介紹使用

nlog是什麼 nlog是乙個基於.net平台編寫的類庫,我們可以使用nlog在應用程式中新增極為完善的跟蹤除錯 nlog是乙個簡單靈活的.net日誌記錄類庫。通過使用nlog,我們可以在任何一種.net語言中輸出帶有上下文的 contextual information 除錯診斷資訊,根據喜好配置...

nlog官方幫助 NLog的介紹使用

centos系統下hadoop 2.4.1集群安裝配置 簡易版 hdu 3668 volume 數學,積分 題意 求圖中交叉圓柱體的體積 析 大體思路很明確,把兩個圓柱的體積加起來 減去中間公共部分的即可 第一步首先得想到公共部分是乙個怎樣的圖形.這個在高數下冊例題中有講到 中間實線部分就是第一卦限...