2010-02-22 48 views
1

正如標題已經說過的,有沒有辦法擺脫每個日誌條目之前和之後放置的頁眉和頁腳何時使用滾動平面文件跟蹤監聽器?企業庫4.0:如何擺脫頁眉和頁腳時使用滾動平面文件跟蹤監聽器

雖然我清除了「Header」和「Footer」屬性,但日誌文件在每個日誌條目之前和之後仍然顯示一個空行。

更新

在這裏你可以看到我使用的配置文件。

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <configSections> 
    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> 
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> 
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
     <section name="CheckLoignWebService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
    </sectionGroup> 
    </configSections> 
    <loggingConfiguration name="Logging Application Block" tracingEnabled="true" 
    defaultCategory="CheckLoginWebService" logWarningsWhenNoCategoriesMatch="true"> 
    <listeners> 
     <add source="Enterprise Library Logging" formatter="Text Formatter" 
     log="Application" machineName="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
     traceOutputOptions="None" filter="All" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
     name="Formatted EventLog TraceListener" /> 
     <add fileName="loginWSTest.log" footer="" formatter="SimpleTextFormatter" 
     header="" rollFileExistsBehavior="Increment" rollInterval="Day" 
     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" 
     traceOutputOptions="None" filter="All" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
     name="Rolling Flat File Trace Listener" /> 
    </listeners> 
    <formatters> 
     <add template="{timestamp}{tab}[{severity}]{tab}{message}" type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
     name="SimpleTextFormatter" /> 
     <add template="Timestamp: {timestamp}&#xD;&#xA;Message: {message}&#xD;&#xA;Category: {category}&#xD;&#xA;Priority: {priority}&#xD;&#xA;EventId: {eventid}&#xD;&#xA;Severity: {severity}&#xD;&#xA;Title:{title}&#xD;&#xA;Machine: {machine}&#xD;&#xA;Application Domain: {appDomain}&#xD;&#xA;Process Id: {processId}&#xD;&#xA;Process Name: {processName}&#xD;&#xA;Win32 Thread Id: {win32ThreadId}&#xD;&#xA;Thread Name: {threadName}&#xD;&#xA;Extended Properties: {dictionary({key} - {value}&#xD;&#xA;)}" 
     type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
     name="Text Formatter" /> 
    </formatters> 
    <categorySources> 
     <add switchValue="All" name="CheckLoginWebService"> 
     <listeners> 
      <add name="Rolling Flat File Trace Listener" /> 
     </listeners> 
     </add> 
    </categorySources> 
    <specialSources> 
     <allEvents switchValue="All" name="All Events" /> 
     <notProcessed switchValue="All" name="Unprocessed Category" /> 
     <errors switchValue="All" name="Logging Errors &amp; Warnings"> 
     <listeners> 
      <add name="Formatted EventLog TraceListener" /> 
     </listeners> 
     </errors> 
    </specialSources> 
    </loggingConfiguration> 
    <applicationSettings> 
    <CheckLoignWebService.Properties.Settings> 
     <setting name="CheckLoignWebService_CNLoginWS_CampusNet_Login" serializeAs="String"> 
     <value>********************</value> 
     </setting> 
    </CheckLoignWebService.Properties.Settings> 
    </applicationSettings> 
</configuration> 
+0

你能發佈你的配置文件嗎? – 2010-03-05 07:39:49

回答

0

我使用EL Logging Quickstart的聽衆和格式化程序。消息在記錄之前或之後沒有任何空行。

3/15/2010 5:10:47 PM [Information] asdaf 
3/15/2010 5:10:58 PM [Information] 22 
3/15/2010 5:11:05 PM [Information] dfas 

您的消息是否可能包含導致空行的新行字符?

+0

恩,我會再檢查一次。感謝您的幫助。 – Flo 2010-03-15 19:27:57

+0

@Flo - 只是好奇,如果你發現任何東西? – 2010-04-08 20:25:36

相關問題