2、建表語句
createtable
tbl_log
( id
varchar2(60) not
null
,varchar2(20
), modulename
varchar2(30
), procname
varchar2(30
), operationtype
varchar2(20
), logger
varchar2(500
), logmessage
varchar2(3000) not
null
, ip
varchar2(32
), longdate
varchar2(36
), username
varchar2(36
), createdate date
default
sysdate,
loglevel
varchar2(12
))
3、nlog.config,正式執行 throwexceptions="false"
<?xml version="1.0" encoding="utf-8"?>=""xmlns:xsi=""xsi:schemalocation=" nlog.xsd"autoreload="true"throwexceptions="true"internalloglevel="info" internallogfile="d:\work\log1.txt">
="true">
="modulename" layout="$"/>
="procname" layout="$"/>
="operationtype" layout="$"/>
="logger" layout="$"/>
="logmessage" layout="$"/>
="ip" layout="$"/>
="time_stamp" layout="$"/>
="username" layout="$"/>
="loglevel" layout="$"/>
="*" minlevel="trace" writeto="database"/>
4、簡單封裝
publicclass
logger
public logger(string name) : this
(logmanager.getlogger(name))
public
static logger default
static
logger()
#endregion
#region process日誌寫入
//////日誌寫入
/// ///
選單大類
///二級選單
///本級選單
///操作型別
///詳細日誌
///ip位址
///使用者名稱 ///
logger
public
logger)
logeventinfo lei = new
logeventinfo();
lei.properties["id
"] = guid.newguid().tostring("d"
); lei.properties[
" lei.properties[
"modulename
"] =modulename;
lei.properties[
"procname
"] =procname;
lei.properties[
"operationtype
"] =operationtype;
lei.properties[
"logmessage
"] =logmessage;
lei.properties["ip
"] =ip;
lei.properties[
"username
"] =username;
lei.properties[
"logger
"] =logger;
lei.level =loglevel.info;
_logger.log(lei);
}//////
日誌寫入,自己傳日誌類別
/// ///
選單大類
///二級選單
///本級選單)
///操作型別
///詳細日誌
///ip位址
///使用者名稱 ///
logger
///日誌級別
public
logger, loglevel level)
logeventinfo lei = new
logeventinfo();
lei.properties["id
"] = guid.newguid().tostring("d"
); lei.properties[
" lei.properties[
"modulename
"] =modulename;
lei.properties[
"procname
"] =procname;
lei.properties[
"operationtype
"] =operationtype;
lei.properties[
"logmessage
"] =logmessage;
lei.properties["ip
"] =ip;
lei.properties[
"username
"] =username;
lei.properties[
"logger
"] =logger;
lei.level =level;
_logger.log(lei);
}#endregion
}
//////
操作型別列舉
/// public
enum
operationtype
5、asp.net中的呼叫列子:
1 logger.default.process("系統管理", "許可權管理", "使用者管理", operationtype.retrieve, "測試寫入", logger.defaultip, logger.defaultuser, this.gettype().tostring(), nlog.loglevel.error); 2 logger.default.process("系統管理", "許可權管理", "使用者管理", operationtype.retrieve, "測試寫入", logger.defaultip, logger.defaultuser, this.gettype().tostring());
使用自定義字段
轉儲所有自定義字段作為列表顯示乙個特定自定義欄位的值id,mood true mood 將是自定義欄位的id值 顯示相同自定義欄位id的多個值id,songs false 僅在存在時顯示自定義字段 邏輯 url get post meta post id,snippet reference url ...
自定義類寫入檔案
對自定義類歸檔 person.h 遵守協議 import class book inte ce person nsobject property copy,nonatomic nsstring name property copy,nonatomic nsstring property strong...
dede自定義欄位table去掉,自定義附件裡面有
我們在使用dede 建設時,自定義附件,讀取是會出 uploads soft 100602 1 10060221235523434.zip 我們在系統內容模型中新增附件型別欄位時,前台需要用來呼叫。例如我在後台發布一篇文章,上傳乙個zip的附件,欄位的時間內容是 uploads soft 10060...