0
我正在嘗試將簡單字符串記錄到日誌文件。 我只需要類別,消息和時間戳。 因此我已經配置的app.config像這樣:Hot將EnterpriseLibrary.Logging配置爲僅輸出消息和時間戳
<listeners>
<add name="Flat File Destination"
fileName="C:\Log\Phoenix.Common.Tests\Debug.log"
header="-----------------------------------------------------------------"
formatter="Text Formatter" footer="" rollFileExistsBehavior="Increment" rollInterval="Midnight" rollSizeKB="0" timeStampPattern="yyyy-MM-dd"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</listeners>
<formatters>
<add name="Text Formatter" template="Category: {category} Message: {message} Timestamp: {timestamp}"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</formatters>
但我得到的所有種類的額外的東西在我的日誌文件:
Priority: 50
EventId: 50 Severity: Verbose
Title:Testing Log
Machine: DK-PC-P4740
App Domain: TestAppDomain: 80803a4f-8e18-47bb-901e-cdac784c8041
ProcessId: 6492
Process Name: C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\QTAgent32.exe
如何避免這種額外的東西嗎? 有人可以給我一個鏈接到一個只記錄消息到日誌文件的例子嗎?