记录由XPO产生和执行的sql语句
//z 2013-02-27 14:01:30 [email protected][T215,L2906,R88,V3140]
1. 在App.Config中添加如下行:
[XML]
<?xml version="1.0"encoding="utf-8"?>
<configuration>
<system.diagnostics>
<switches>
<addname="XPO"value="3"/>
</switches>
</system.diagnostics>
</configuration>
2. 如果想记录到一个文件
在应用程序的配置文件中加入:
[XML]
<?xml version="1.0"encoding="utf-8"?>
<configuration>
<system.diagnostics>
<traceautoflush="true"indentsize="4">
<listeners>
<addname="LogFileTraceListener"type="System.Diagnostics.TextWriterTraceListener"
initializeData="trace.log"/>
<removename="Default"/>
</listeners>
</trace>
<switches>
<addname="XPO"value="3"/>
</switches>
</system.diagnostics>
</configuration>
//z 2013-02-27 14:01:30 [email protected][T215,L2906,R88,V3140]
3. 使用 System.Diagnostics trace logging 机制
[C#]
System.Diagnostics.Trace.Listeners.Add(newMyTraceListner(textBox1));
...
class MyTraceListner:System.Diagnostics.TraceListener{
TextBox outputWindow;
public MyTraceListner(TextBoxoutputWindow){
this.outputWindow=outputWindow;
}
public overridevoidWrite(stringmessage){
outputWindow.AppendText(message);
}
public overridevoidWriteLine(stringmessage){
outputWindow.AppendText(message+"\r\n");
}
}
记录 日志 跟踪 trace sql log debug xpo DevExpress
//z 2013-02-27 14:01:30 [email protected][T215,L2906,R88,V3140]